Skip to content

🎲 rnd

rnd

The rnd module provides facilities to introduce randomness in the composition.

Cookbook

Get a random number between two values

rnd.between(1, 10)

Reference

between(begin, end)

Get a random number between two values.

Parameters:

Name Type Description Default
begin float

The lower bound.

required
end float

The upper bound.

required

one_in(chance)

Returns True with a chance of 1 in chance.

Parameters:

Name Type Description Default
chance int

The chance of returning True.

required