色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

50位的隨機數(shù)怎么生成

洪振霞2年前23瀏覽0評論

50位的隨機數(shù)怎么生成?

//測試通過,見代碼實現(xiàn)

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Collections;

import java.util.List;

import java.util.Random;

public class RandomTestA {

public static void main(String[] args) {

Random r = new Random();

float sum=0;

List list=new ArrayList();

for (int i = 0; i < 100; i++) {

float a=r.nextFloat()*100;

list.add(a);

}

Collections.sort(list);

for (int i = 0; i < list.size(); i++) {

sum+=(Float) list.get(i);

}

System.out.println("和="+sum);

System.out.println("平均值="+(sum/100));

System.out.println("最小值="+list.get(0));

}

}

java不重復的隨機數(shù),50位的隨機數(shù)怎么生成