Skip to content

Commit

Permalink
feat(utils): methods for getting a random signum
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Jun 26, 2022
1 parent eec70ca commit 55240a9
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -117,4 +117,17 @@ public static boolean fractionChance(int numerator, int denominator, Random rand

// #endregion Chance

/*================================================================================================================*/
// #region Signum

public static int nextSignum() {
return RANDOM.nextBoolean() ? 1 : -1;
}

public static int nextSignum(Random random) {
return random.nextBoolean() ? 1 : -1;
}

// #endregion Signum

}

0 comments on commit 55240a9

Please sign in to comment.