Module random
Random is a static utility that provides fast and easy access to
random numbers.
max |
The internal maximum value. |
min |
The internal minimum value. |
random_provider |
The provider for random numbers. |
Functions
-
init ()
-
Initializes random. Should not be called from the client.
-
next_bool (chance)
-
Returns true or false based on the given chance.
Parameters:
- chance
Optional. The "one in chance" chance to get true, defaults
to 2 (ans in "one in two").
Returns:
true or false based in the given chance.
-
next_float (lower_bound, upper_bound, decimal_places)
-
Returns a float between the given bounds.
Parameters:
- lower_bound
Optional. The lower bound (inclusive), defaults to 0.
- upper_bound
Optional. The upper bound (inclusive), defaults to 1.
- decimal_places
Optional. To how many decimal places the resulting
float should be rounded.
Returns:
a float between the given bounds.
-
next_int (lower_bound, upper_bound)
-
Returns an int between the given bounds.
Parameters:
- lower_bound
Optional. The lower bound (inclusive), defaults to
random.min.
- upper_bound
Optional. The upper bound (inclusive), defaults to
random.max.
Returns:
a integer between the given bounds.
Fields
-
max
-
The internal maximum value.
-
min
-
The internal minimum value.
-
random_provider
-
The provider for random numbers.