# `urandom` – Random Number Generation¶

The module ‘’urandom’’ provides functions for random number generation. ‘’urandom’’ is based upon the `random` module in the Python standard library.

## Functions¶

`urandom.``getrandbits`(n)

Returns an integer with `n` random bits where n may be between 1-32 (inclusive).

`urandom.``seed`(n)

Initialize the random number generator with a known integer `n`. This will give you reproducibly deterministic randomness from a given starting state (`n`).

`urandom.``randint`(a, b)

Return a random integer `N` such that `a <= N <= b`. Alias for `randrange(a, b+1)`.

`urandom.``randrange`(stop)

Return a randomly selected integer between zero and up to (but not including) `stop`.

`urandom.``randrange`(start, stop)

Return a randomly selected integer from `range(start, stop)`.

`urandom.``randrange`(start, stop, step)

Return a randomly selected element from `range(start, stop, step)`.

`urandom.``choice`(seq)

Return a random element from the non-empty sequence `seq`. If `seq` is empty, raises `IndexError`.

`urandom.``random`()

Return the next random floating point number in the range [0.0, 1.0)

`urandom.``uniform`(a, b)

Return a random floating point number `N` such that `a <= N <= b` for `a <= b` and `b <= N <= a` for `b < a`.