rt

An obligatory Java Project
Log | Files | Refs | LICENSE

commit 8f64ca0c20d6780f359e98a5a0659106849ca7c8
parent f617805bf9f9f843dff1884fdae9a9916f7a81fc
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Thu, 12 Dec 2019 22:44:14 +0100

Return 1 if nextInt() returns 0

Diffstat:
Mutil.java | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/util.java b/util.java @@ -34,10 +34,11 @@ public class util { } public static int getRandomInt() { - int res = 1; + int res = 0; Random r = new Random(); - while ((res = r.nextInt(5)) != 0) - return res; + res = r.nextInt(5); + if (res == 0) + return 1; return res; } }