码迷,mamicode.com
首页 > 其他好文 > 详细

随机函数

时间:2014-10-22 12:46:11      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:amp   ui   return   函数   public   c   dom   static   di   

public static int Random(int min, int max)
{
if (min >= max)
return min;

int diff = max - min;
int ran = (int)Random();
ran = ran % (diff + 1);
return min + ran;
}

public static uint Random()
{
nextRandomSeed = (nextRandomSeed * 214013 + 2531011) % 2147483647;
return (nextRandomSeed >> 1) & 0xffff;
}

随机函数

标签:amp   ui   return   函数   public   c   dom   static   di   

原文地址:http://www.cnblogs.com/Asuphy/p/4042727.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!