System Entropy¶

randomgen.entropy.random_entropy(size=
None
, source='system'
)¶ Read entropy from the system cryptographic provider
 Parameters:¶
 size=
None
¶ Output shape. If the given shape is, e.g.,
(m, n, k)
, thenm * n * k
samples are drawn. Default is None, in which case a single value is returned. source=
'system'
¶ Source of entropy. ‘system’ uses system cryptographic pool. ‘fallback’ uses a hash of the time and process id. ‘auto’ attempts ‘system’ before automatically falling back to ‘fallback’
 size=
 Returns:¶
entropy – Entropy bits in 32bit unsigned integers. A scalar is returned if size is None.
 Return type:¶
scalar
ornumpy.ndarray
Notes
On Unixlike machines, reads from
/dev/urandom
. On Windows machines reads from the RSA algorithm provided by the cryptographic service provider.This function reads from the system entropy pool and so samples are not reproducible. In particular, it does NOT make use of a bit generator, and so
seed
and settingstate
have no effect.Raises RuntimeError if the command fails.