Skip to content
Snippets Groups Projects

Seed urandom with TRNG

Merged koalo requested to merge koalo/use-trng-in-urandom into master
All threads resolved!
Files
4
+ 53
0
.. py:module:: urandom
``urandom`` - Random Number Generation
======================================
The :py:mod:`urandom` module allows you to generate random numbers. Please note that this module is currently only *seeded* with the TRNG and uses pseudo random numbers for later invocations.
**Example**:
.. code-block:: python
import urandom
print(urandom.random())
.. py:function:: urandom.getrandbits(num)
Return random bits.
:param int num: Number of random bits to generate (max. 32)
:returns: An integer with numin bit randomly set.
.. py:function:: urandom.seed(seed)
:param int seed: Integer to seed the random number generator with.
.. py:function:: urandom.randrange(start, stop[, step])
Return a random number from the `range(start, stop, step)`.
:returns: A random number from the range.
.. py:function:: urandom.randint(a,b)
Return a random integer `N` with `a <= N <= b`.
:returns: A random number from the range.
.. py:function:: urandom.choice(seq)
Return a random element from the given sequence.
:returns: A random number from the sequence.
.. py:function:: urandom.random()
Return a random floating point number `x` with `0 <= x < 1`.
:returns: A random number from the range.
.. py:function:: urandom.uniform(a, b)
Return a random floating point number `x` with `a <= x <= b`.
:returns: A random number from the range.
Loading