首页 > Web开发 > 详细

.net 随机数

时间:2018-07-04 14:57:50      阅读:196      评论:0      收藏:0      [点我收藏+]

 

 1  static int GetRandomSeed()
 2     {
 3         byte[] bytes = new byte[4];
 4         System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
 5         rng.GetBytes(bytes);
 6         return BitConverter.ToInt32(bytes, 0);
 7     }
 8 
 9     static int GetNumber()
10     {
11         return Math.Abs(GetRandomSeed());
12     }

 

.net 随机数

原文:https://www.cnblogs.com/cg-931210/p/9263162.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!