好好学习,东方不败。

做个努力的小伙。

  博客园  :: 首页  :: 新随笔  ::  ::  :: 管理
c#生成(随机数 http://www.jbxue.com/tags/suijishu.html)的代码。
/// 构造随机数 种子
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);

///  生成随机 数
static int rnd()  
{     
            Random ran = new Random(GetRandomSeed());         
            int cnt = ran.Next(0,59);
            return cnt;
 }
posted on 2014-03-03 06:38  snowfly123  阅读(259)  评论(0编辑  收藏  举报