C#提高随机数不重复概率的种子生成方法

C#提高随机数不重复概率的种子生成方法

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( ) );

编程技巧