Skip to main content

chance(percentage)

Signature: chance(percentage: Any) -> bool

Return true with the given percentage probability. Accepts numeric values or strings like "25%".

Example

function example() returns null {
if chance("50%") {
print("Heads")
}
}