Léon

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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

posted on 2014-05-02 15:46  Léon  阅读(304)  评论(0编辑  收藏  举报