Handle non positive bound values.

This commit is contained in:
MobiusDevelopment
2021-10-17 18:16:56 +00:00
parent 4476627c5c
commit 7612b7897a
24 changed files with 72 additions and 72 deletions

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**

View File

@ -50,7 +50,7 @@ public class Rnd
*/ */
public static int get(int bound) public static int get(int bound)
{ {
return ThreadLocalRandom.current().nextInt(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextInt(bound);
} }
/** /**
@ -77,7 +77,7 @@ public class Rnd
*/ */
public static long get(long bound) public static long get(long bound)
{ {
return ThreadLocalRandom.current().nextLong(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextLong(bound);
} }
/** /**
@ -104,7 +104,7 @@ public class Rnd
*/ */
public static double get(double bound) public static double get(double bound)
{ {
return ThreadLocalRandom.current().nextDouble(bound); return bound <= 0 ? 0 : ThreadLocalRandom.current().nextDouble(bound);
} }
/** /**