Skip to content

Commit

Permalink
Merge pull request #75 from hamoid/randomBoolProbability
Browse files Browse the repository at this point in the history
Add probability to Random.bool()
  • Loading branch information
edwinRNDR authored Apr 10, 2020
2 parents 933be5b + 5650172 commit b807986
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions orx-noise/src/main/kotlin/Random.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ object Random {
return rnd.nextInt(min, max)
}

fun bool(): Boolean {
return rnd.nextBoolean()
fun bool(probability: Double = 0.5): Boolean {
return rnd.nextDouble(1.0) < probability
}

fun <T> pick(coll: Collection<T>): T {
Expand Down

0 comments on commit b807986

Please sign in to comment.