import java.util.Random;
public class RandomTest {
public static void main(String[] args) {
//随机生成10个0-100的正整数
System.out.print("Math.random:");
for (int i = 0; i < 10; i++) {
System.out.print((int) (Math.random() * 100)+"\t");
}
//随机生成10个0-100的正整数
System.out.print("\nRandom:");
Random random = new Random();
for(int i = 0; i < 10; i++){
System.out.print(random.nextInt(100)+"\t");
}
//随机生成10个0-100的正整数
System.out.print("\nwhile:");
int i = 0;
while(i < 10){
System.out.print((int) (Math.random() * 100)+"\t");
i++;
}
//随机生成10个0-100的正整数
System.out.print("\ndo while:");
int j = 0;
do{
System.out.print((int) (Math.random() * 100)+"\t");
j++;
}while(j < 10);
}
}