random

Return a random floating-point number in the 0 -> 1 range.

Syntax

random()

Returns

Float — Random floating-point value in 0 -> 1 (1 is exclusive).

Example

chance = random()
if chance < 0.25:
    text("lucky")