If you search for examples of creating a seeded (pseudo)Random number generator, you will run into stuff like this (specific example http://indiegamr.com/generate-repeatable-random-numbers-in-js/):
// the initial seed
Math.seed = 6;
// in order to work 'Math.seed' must NOT be undefined,
// so in any case, you HAVE to provide a Math.seed
Math.seededRandom = function(max, min) {
max = max || 1;
min = min || 0;
Math.seed = (Math.seed * 9301 + 49297) % 233280;
var rnd = Math.seed / 233280;
return min + rnd * (max - min);
}
Those specific numbers (9301, 49297, 233280) and algorithm are used over and over, but nobody seems to have a definitive reference for this. Who invented this algorithm and tested the distribution? Is there a paper or something to cite?
Best Answer
A quick search of Google Books shows these numbers (9301, 49297, 233280) have been used in a number of references:
The oldest is 1977's Computer methods for mathematical computations by George Elmer Forsythe, Michael A. Malcolm, Cleve B. Moler (Prentice-Hall), although Google doesn't show where the text was used in the book so it cannot be verified.
The earliest showing the text is Numerical Recipes in Pascal (First Edition): The Art of Scientific Computing, Volume 1 by Press, Teukolsky, Vetterling and Flannery in a full-page table of "Constants for Portable Random Number Generators". These particular numbers are given with an overflow at 2^31.
The Numerical Recipes series of books are hugely popular, and have been in print since 1986.