Crate rand_jitter

source ·
Expand description

Non-physical true random number generator based on timing jitter.

Note that this RNG is not suited for use cases where cryptographic security is required (also see this discussion).

This is a true random number generator, as opposed to pseudo-random generators. Random numbers generated by JitterRng can be seen as fresh entropy. A consequence is that it is orders of magnitude slower than OsRng and PRNGs (about 103..106 slower).

There are very few situations where using this RNG is appropriate. Only very few applications require true entropy. A normal PRNG can be statistically indistinguishable, and a cryptographic PRNG should also be as impossible to predict.

JitterRng can be used without the standard library, but not conveniently, you must provide a high-precision timer and carefully have to follow the instructions of JitterRng::new_with_timer.

This implementation is based on Jitterentropy version 2.1.0.

Note: There is no accurate timer available on WASM platforms, to help prevent fingerprinting or timing side-channel attacks. Therefore [JitterRng::new()] is not available on WASM. It is also unavailable with disabled std feature.



  • A true random number generator based on jitter in the CPU execution time, and jitter in memory access time.