random
random <pct>
A random chance: true roughly pct percent of the time.
Each call rolls a fresh percentile (1–100) and reports whether the roll is
less than or equal to pct. So random 100 is always true, random 0
is always false, and random 25 is true about a quarter of the time.
Arguments
<pct>— an int percentage, normally 0–100.
Returns
A bool — true with probability pct%, false otherwise.
Examples
after command (say) {
if [random 100] {
do "say (This always happens.)"
}
}
[random 100] is always true, so the body always runs — useful for
confirming the call before tuning the percentage down.
handle tick {
require [random 5]
emit room "$self shuffles restlessly."
}
On each tick the guard passes about 5% of the time, so the
owner fidgets only occasionally; the rest of the time the script advances
without acting (see require).