randomByChance

fun randomByChance(chance: Double, random: Random): Boolean

Returns true with probability chance (0.0 < 1.0)

chance <= 0.0 -> return false

chance >= 1.0 -> return true


inline fun randomByChance(chance: Double, random: Random, action: () -> Unit)
inline fun EvolveScope<*, *>.randomByChance(chance: Double, action: () -> Unit)

Execute action with probability chance (0.0 < 1.0)

chance <= 0.0 -> return false

chance >= 1.0 -> return true

See also