random.int

Generates a random integer sampled uniformly from the range of integers from 0 up to, but not including, the given bound.

Note

The result is generated using the cryptographically secure random number generator, and uses rejection sampling to ensure the result is uniformly distributed.

Syntax

int(upperBound)

Parameters

Return value

A random number (number or BigInt).

Example

random.int(15)
6
random.int(2n ** 128n)
231790083173559536705087892161067902023