We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e735e51 commit e2005abCopy full SHA for e2005ab
src/main/java/io/luna/util/RandomUtils.java
@@ -231,6 +231,18 @@ public static int random(Range<Integer> range) {
231
return inclusive(low, high);
232
}
233
234
+ /**
235
+ * Returns a randomly chosen boolean value.
236
+ * <p>
237
+ * Each invocation uses {@link ThreadLocalRandom#current()} and produces either {@code true} or {@code false}
238
+ * with equal probability.
239
+ *
240
+ * @return A random boolean value.
241
+ */
242
+ public static boolean random() {
243
+ return ThreadLocalRandom.current().nextBoolean();
244
+ }
245
+
246
/* Shuffle overloads for all supported types. */
247
public static <T> T[] shuffle(T[] array) {
248
for (int i = array.length - 1; i > 0; i--) {
0 commit comments