Random Generators
Generate pseudo-random numbers and choices.
Use the different methods of the built-in random object for this.
Int()
Int()random.int(min, max, count)Parameters
An integer.
The start of the range.
An integer.
The end of the range.
Optional parameter (default is 1)
How many random numbers to generate.
An integer.
Float()
Float()random.float(min, max, count, decimals, unique)Parameters
A float.
The start of the range.
A float.
The end of the range.
Optional parameter (default is 1)
How many random numbers to generate.
An integer.
Optional parameter (default is 16)
How many decimals (max) to include.
A boolean (True/False).
Should the numbers generated be unique?
Element()
Element()random.element(iterable, count, weights, unique)Parameters
The iterable to get random elements from.
E.g. a list.
Optional parameter (default is 1)
How many random choices/elements to generate.
An integer.
Optional weights for the generation.
A list.
A boolean (True/False).
Should the generated choices/elements be unique?
Last updated