欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C# 生成隨機(jī)數(shù)的代碼

 更新時(shí)間:2015年03月23日 16:18:20   投稿:hebedich  
這篇文章主要介紹了C# 生成隨機(jī)數(shù)的代碼的相關(guān)資料,非常的簡(jiǎn)單實(shí)用,需要的朋友可以參考下
/// 構(gòu)造隨機(jī)數(shù) 種子
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);
} 
 
/// 生成隨機(jī) 數(shù)
static int rnd() 
{
      
      Random ran = new Random(GetRandomSeed());     
      int cnt = ran.Next(0,59);
      return cnt;
 }

以上就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡,能夠?qū)Υ蠹覍W(xué)習(xí)C#有所幫助。

相關(guān)文章

最新評(píng)論