Skip to content

Commit

Permalink
KaraTemplater: util.rand.choice
Browse files Browse the repository at this point in the history
  • Loading branch information
The0x539 committed Jun 27, 2021
1 parent 7f6827e commit 7a2ba03
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/0x.KaraTemplater.moon
Expand Up @@ -37,6 +37,9 @@ util = (tenv) -> {

-- A boolean with a truth probability of p.
bool: (p=0.5) -> math.random! < p

-- Either of two things, with p chance of picking the first.
choice: (a, b, p) -> if tenv.util.rand.bool p then a else b
}
}

Expand Down

0 comments on commit 7a2ba03

Please sign in to comment.