package com.youjiuye.work;
import java.util.Random;
public class 随机数Prandom {
public static void main(String[] args) {
Random r1 = new Random();
// System.out.println(r1.nextBoolean());
// System.out.println(r1.nextDouble());
// System.out.println(r1.nextFloat());
// System.out.println(r1.nextInt());
//生成0~30之间的随机数,加20就是20~50的随机数.
int i =r1.nextInt(31) + 20;
System.out.println(i);
}
}
03-13
564