Files
javaSE251223/day07/src/com/inmind/random02/Demo06.java

19 lines
440 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.random02;
import java.util.Random;
/*
获取10个55~66之间的值包含55和66
random.nextInt(10);//获取0~9的随机数
*/
public class Demo06 {
public static void main(String[] args) {
Random random = new Random();
for (int i = 0; i < 1000; i++) {
int result = random.nextInt(12)+55;//0~9: 55~66 -55 -->0~11--->12
System.out.println(result);
}
}
}