oorandom 9.3.4

A tiny, robust PRNG implementation.
Documentation
# oorandom

[![Crates.io](https://img.shields.io/crates/v/oorandom.svg)](https://crates.io/crates/oorandom)
[![Docs](https://docs.rs/oorandom/badge.svg)](https://docs.rs/oorandom)

A minimalistic pseudorandom number generator in Rust.  For those times
when the `rand` crate is just too *good* and you want something a bit
dumber.

More specifically, it implements ONE prng, which is probably a
permuted congruential generator (PCG) but may change without warning
if something better comes along.  It will give you `u32` or
`u64`, or floating-point equivalents.  Anything else is gravy.

Basically the same as <https://github.com/Lokathor/randomize>.  Except
MINE, not HIS!  HAH!  Actually, a lot of the code came from
`randomize` and I wouldn't have done this if I didn't know of that
library.  So if there are any bugs, I copied them from `randomize`.

# A brief history of random numbers

The usefulness of random numbers has been known for a long, long time
to people who also knew how to use slide rules.  If you wanted to do
some math without the bother of coming up with all that pesky input
data from the real world, you might as well just use any ol' number,
as long as it didn't heck up your math too bad.  So in the first half
of the 20th century you had little old ladies named Edith spinning
roulette wheels or pulling bingo balls out of baskets and writing the
results down, which got assembled into giant tomes and published so
that engineering schools could buy them and have giant tomes sitting
on their shelves.  Anyone who wanted some meaningless numbers could
pull the tome down, flip it open to a presumably-random page, and
there were all the random numbers anyone could want.  Life was good.

In late 1940's computers were invented, but they were far too big and
expensive to be put on the task of *intentionally* generating
nonsense, and things carried on as before.  If you needed random
numbers in a computer program, you just got a pretty young lady named
Marie to transcribe part of the book to punch cards for you.

Around the early 60's computers got fast enough that Edith and Marie
couldn't keep up with them, so they got downsized and replaced with
more computers.  To do this people came up with Linear Congruential
Generators (LCG's), which could generate lots of numbers numbers that
weren't really random, but sure looked random.  LCG's worked on
computers that even a second-rate university could afford, and so the
problem was solved.

At some unknown point in here, presumably sometime in the 60's or
70's, someone seems to have invented Linear Feedback Shift Registers
(LFSR's) as well.  These made random-looking numbers and were really
easy to implement in hardware instead the LCG, which needed complicated
things like binary multipliers.  The random-looking numbers made by
LFSR's were good enough for hardware people, so they started using
LFSR's whenever they needed to and never looked back.

Anyway, by the late 60's people who knew how to use slide rules had
realized that using numbers that only *looked* random could really
heck up their math pretty bad, and one of the more common LCG
implmentations, RANDU, was actually about as bad as possible.  So,
just using any old LCG wasn't good enough, you had to use one made by
someone with a PhD in mathematics.  Donald Knuth shook his fist at the
world and shouted "Hah!  I told you so!", published a book on how to
do it Right that most people didn't read, and then went back into his
Fortress of Solitude to write TeX.  Because it was crated by IBM,
RANDU's awfulness is now enshrined forever in history documents like
this one, and because the people writing OS's and programming
languages at the time weren't doing much slide-rule stuff and didn't
actually need a lot of good random-looking numbers, everyone went back
to using whatever old crap RNG they were using anyway.

Also, sometime in the 70's or 80's the arts of cryptography started
leaking from classified government works into the real world.  People
started thinking about how much money they could make from scrambling
satellite TV so that plebs with HAM radio licenses couldn't watch it,
and these people started giving more money to people who had PhD's in
mathematics.  It was quickly determined that neither LCG's nor LFSR's
made good enough random-looking numbers to really deter someone who
knew how to use a slide rule, and since Edith had long ago retired to
a small beach house in New Jersey, they needed to figure out how to
get computers to make better random-looking numbers.  But making
random-looking numbers good enough for cyptography was slow and
involved lots of things that nobody else really cared about, so that
topic went off on its own adventures and will not be further
mentioned.

Things more or less trundled along this way until the late 90's, when
suddenly computers were everywhere and there was a new generation of
people who had grown up too late to know how to use slide rules, so
they did all their math with computers.  They were doing a LOT of math
by now, and they looked around and realized that their random-looking
numbers really weren't very random-looking at all, and this was
actually something of a problem by now.  So the Mersenne Twister got
invented.  It was pretty slow and used a lot of memory and made kinda
mediocre random numbers, but it was way better than a bad LCG, and
most importantly, it had a cool name. Most people didn't want to read
Knuth's book and figure out how to make a non-bad LCG, so everyone
started using the Mersenne Twister whenever possible.

This is where things stood until the early 2010's, when I finished my
MS and started paying attention again.  People suddenly realized it
was possible to make random-looking numbers better than the Mersenne
Twister using an algorithm called xorshift.  Xorshift was fast, it
made pretty random-looking numbers, and it didn't need a whole 3
kilobytes of state just sitting around taking up space and causing
comment among the neighbors at church.  It did sometimes have problems
with some of its numbers not looking random enough in a few select
circumstances, but a couple people with PhD's in mathematics slowly
and patiently spent years figuring out ways to work around these
problems, leading to a whole confusing family of related things such
as xoshiro, xoroshiro, xoroshiro+, xoroshiro*, and so on.  Nobody else
could really tell the difference between them, but everyone agreed
they were better than Mersenne Twister, easier to implement, and the
name was nearly as cool.  Many papers were published and a good time
was had by all.

At least until the late 2010's when some bright young spark figured
out that it actually wasn't too hard, if you read Knuth's book and
paid attention to what you were doing, to take the old LCG and hop it
up on cocaine and moon juice.  The result got called the Permuted
Congruential Generator, or PCG.  This quite miffed the people working
on xorshift generators by being almost as small and fast, using xor's
and bit shifts (that's xorshift's turf, dammit, it's right in the
name!), and producing random-looking numbers that satisfied even the
people who had learned to use slide rules for fun in this latter age.
Since nobody had figured out any downsides to PCG's yet, everyone
shrugged and said "might as well just go with that then", and that is
where, as of 2019, the art currently stands.