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

随机数

时间:2015-07-10 11:17:52      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:

1. 取某个范围的任意数

public static String getRandom(int min, int max)
{
Random random = new Random();
int s = random.nextInt(max) % (max - min + 1) + min;
return String.valueOf(s);

}

 

随机数

标签:

原文地址:http://www.cnblogs.com/a198720/p/4634986.html

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