A small random number generator hacked on top of Rust’s standard library.
Rust, as you may well know, has support for
These maps, as per their name, require hashing.
Hashing, of course, takes some data, and produces a random representation of that data.
Where we hash, random numbers follow!
“Well, it seemed like a good idea at the time…”
— You explaining
attorandto your smart contract shareholders, probably.
Other crates, like
rand, can be hard to use cross-platform,
Because they rely on the system’s source of randomness.
attorand, however, does not have this limitation,
and provides a firehose of random bytes to drink from.
attorand works by repeatedly hashing a seed,
using the output of the last round as the input to the next.
The algorithm used is SipHash 1-3, as per Rust’s
standard library docs,
but note that this is “subject to change at any point in the future”.
Please don’t use this for anything that needs cryptographic randomness. (You knew that.)
I hold no further responsibility for this abomination.
Welp, That’s it from me. What are you waiting for?
Allocate a fresh
Rng to get started!
A portable random number generator built on Rust’s default
Has no dependencies other than the standard library (doh).
This random number generator is not cryptographically secure, not the fastest, yada yada yada,
so don’t use it unless you have a really good reason to.