keithw/mosh — pull request #68 by kmcallister (2012-03-19 09:34:13+00:00)
Title: Improve chaff randomness

There are two problems with Mosh's randomized chaff:

* `srand(time(NULL))` is very predictable.
* `rand()` provides low-quality randomness on some platforms.

We solve both of these by implementing [Marsaglia's MWC256 pseudorandom number generator](http://forums.wolfram.com/mathgroup/archive/2003/Feb/msg00456.html) and seeding its 1 kB of state from `/dev/urandom`.

I don't have a formal argument for why we don't need cryptographic-strength randomness here. But MWC256 should anyway be a large improvement over `rand()`.