From c8c11c6b4157757b37b3772bf3dbdce30151e7b3 Mon Sep 17 00:00:00 2001 From: xuxin <840198532@qq.com> Date: Mon, 19 Jan 2026 15:17:57 +0800 Subject: [PATCH] =?UTF-8?q?day07-=E5=B8=B8=E7=94=A8=E7=B1=BB-random?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E5=9F=BA=E6=9C=AC=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- day07/src/com/inmind/random02/Demo05.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/day07/src/com/inmind/random02/Demo05.java b/day07/src/com/inmind/random02/Demo05.java index e0db8bd..cd838b5 100644 --- a/day07/src/com/inmind/random02/Demo05.java +++ b/day07/src/com/inmind/random02/Demo05.java @@ -19,6 +19,14 @@ public class Demo05 { public static void main(String[] args) { //获取10个 【55~66,包含55和66】之间的随机值 + //55~66 - 55 ---> 0~11 ----->random.nextInt(12) + Random random = new Random(); + for (int i = 0; i < 100; i++) { +// int val = random.nextInt(12)+55; + int val = random.nextInt(55, 67);//17以上才有 + System.out.println(val); + } + }