C#产生不重复随机数
时间:2014-05-12 15:58:55
收藏:0
阅读:302
static int GetRandomSeed(
)
{
byte[] bytes = new
byte[4];
System.Security.Cryptography.RNGCryptoServiceProvider
rng = new System.Security.Cryptography.RNGCryptoServiceProvider(
);
rng.GetBytes( bytes );
return
BitConverter.ToInt32( bytes , 0
);
}
Random random = new Random(
GetRandomSeed( ) );
原文:http://www.cnblogs.com/caroar/p/3704114.html
评论(0)