JAVA 生成随机数!
代码:
public class Suijishu {
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26public static void main(String[] args){ //生成 Long random = new Long((int)((Math.random()*9+1)*100000)); Long random1 = new Long((int)((Math.random()*9+1)*100000)); Long random2 = new Long((int)((Math.random()*9+1)*100000)); Long random3 = new Long((int)((Math.random()*9+1)*100000)); Long random4 = new Long((int)((Math.random()*9+1)*100000)); Long random5 = new Long((int)((Math.random()*9+1)*100000)); Long random6 = new Long((int)((Math.random()*9+1)*100000)); Long random7 = new Long((int)((Math.random()*9+1)*100000)); Long random8 = new Long((int)((Math.random()*9+1)*100000)); //打印 System.out.println(random.toString()); System.out.println(random1.toString()); System.out.println(random2.toString()); System.out.println(random3.toString()); System.out.println(random4.toString()); System.out.println(random5.toString()); System.out.println(random6.toString()); System.out.println(random7.toString()); System.out.println(random8.toString()); }
}
效果:
最后
以上就是粗犷小蜜蜂最近收集整理的关于JAVA 用JAVA代码生成随机数!的全部内容,更多相关JAVA内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复