Skip to content

Commit 366e00c

Browse files
committed
Fix Mathf.randomBoolean missing
1 parent 06d017a commit 366e00c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arc-core/src/arc/math/Mathf.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ public static boolean randomBoolean(){
266266
return rand.nextBoolean();
267267
}
268268

269+
/** Returns true if a random value between 0 and 1 is less than the specified value. */
270+
public static boolean randomBoolean(float chance){
271+
return Mathf.random() < chance;
272+
}
273+
269274
/** Returns random number between 0.0 (inclusive) and 1.0 (exclusive). */
270275
public static float random(){
271276
return rand.nextFloat();

0 commit comments

Comments
 (0)