package com.Lucky.OftenClass; import java.util.Random; /** * Random :随机类 * * 注意点:Math.Random()底层调用的是Random的nextDouble方法 */ public class RandomClass { public static void main(String[] args) { Random random=new Random(); //遍历10个随机数 for (int i = 0; i < 10; i++) { //System.out.print(random.nextInt(11)+10+"\t");//10~20 //System.out.print(random.nextInt((20)));//0~20 System.out.println(Math.ceil(random.nextDouble())); } } }
标签:10,常用,Random,java,random,System,out From: https://www.cnblogs.com/Lucky-only/p/16922241.html