Re: [PATCH 13/10] tests for various pack index features
- From
Nicolas Pitre <nico@cam.org>
- Date
- Apr 11, 2007, 17:29 UTC
- Message-ID
- <alpine.LFD.0.98.0704111316290.28181@xanadu.home>
- In-Reply-To
- <20070411145103.GP5436@spearce.org>
On Wed, 11 Apr 2007, Shawn O. Pearce wrote:
Show 14 quoted lines
> Olivier Galibert <galibert@pobox.com> wrote: > > On Wed, Apr 11, 2007 at 08:57:09AM -0400, Nicolas Pitre wrote: > > > Hmmm what we need is a random data generator that always produces the > > > same thing. I'll hack something to replace urandom. > > > > Don't hack something, ues the standard reference, the Mersenne Twister. > > > > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html > > > > PRNGs are the same as cryptosystems, it's very easy to hack up > > something and get it very, very wrong. And it's unnecessary, since > > there are very good ones available. > > Indeed.
Please don't get too excited.
We don't want a full fledged random number generator with a period of 2^30000 that is faster than light and impossible to predict, etc, etc.
The _only_ thing we want is a convenient way to produce large files with garbage that is neither compressible nor deltifiable, but still reproducible. And for that matter the Mersenne Twister algo is _way_ too heavy for our needs.
The one that I just implemented basically boils down to:
while (count--) {
next = next * 1103515245 + 12345;
putchar((next >> 16) & 0xff);
}and that does the job perfectly well.
Nicolas