Math.random()练习

package Sep_16;

public class Array {
public static void main(String[] args) {
String a[]=new String[]{"张三","李四","王五","赵六","鬼脚七"};
System.out.println(a[(int) (Math.random()*a.length)]);


int []array={2,35,26,754,358,346,906,356,14,89,};
double b=Math.random();
double c=Math.random()*array.length;
int index=(int) (Math.random()*array.length);
System.out.println(array[index]);


}
}

posted @ 2017-09-16 20:41  wanghusuoyi  阅读(311)  评论(0编辑  收藏  举报