4 releases (2 stable)

1.1.0 Mar 29, 2022
1.0.0 Mar 28, 2022
0.2.0 Mar 28, 2022
0.1.0 Sep 28, 2020

#2199 in Algorithms

MIT license

35KB
696 lines

Krull64/65 Random Number Generators

Sample with Confidence

  • High quality, non-cryptographic, medium-fast RNGs.
  • "Trivially strong" algorithms combining LCGs with a strong output hash.
  • 64-bit output, 192-bit (Krull64) or 256-bit (Krull65) state.
  • 2**64 (Krull64) or 2**128 (Krull65) pairwise independent streams of period 2**128.
  • Streams are equidistributed with each 64-bit number appearing 2**64 times.
  • Full state space with no bad states and no bad seeds.
  • Random access inside streams.
  • No unsafe code and no std required.
  • LCGs are run economically with 65-bit multipliers using 64-to-128-bit widening multiplies.

Krull64/65 are intended as non-cryptographic workhorse RNGs suitable for simulations and procedural content generation that are solid, easy to use, and have a full feature set.

Crate

This crate depends on rand_core, which is a part of the Rand project.

Serde support is opt-in, so enable the serde feature if you need it.

License

MIT

Dependencies

~1.5MB
~39K SLoC