首页 > 编程语言 > 详细

随机数算法

时间:2016-05-13 18:50:13      阅读:236      评论:0      收藏:0      [点我收藏+]

package t9;

import java.util.Random;

import javax.swing.JOptionPane;

public class t9 {

public static void main(String[] args) 
{


int []a=new int[10];
int i,k=0;
for(i=0;i<10;i++)
{
Random random1= new Random();
a[i]=random1.nextInt(100);
k=k+a[i];
}
String x=new String();
for(i=0;i<10;i++)
{
x=x+" "+a[i];
}
x=x+"\n和为"+k;
JOptionPane.showMessageDialog( null, x,
"Demonstrating String Class Constructors",
JOptionPane.INFORMATION_MESSAGE );

}

}

随机数算法

原文:http://www.cnblogs.com/LJT666/p/5490353.html

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