Write makeRng(seed), which returns a function. Each call to that function returns the next number of a repeatable sequence, so that code which takes a generator as a parameter can be tested.
- Every returned number is at least
0 and below 1 - Two generators made with the same seed return exactly the same sequence, and each keeps its own state, so calling one does not move the other
- Generators made with different seeds return different sequences
- Do not call
Math.random, which cannot be seeded - The seed is a non-negative whole number;
0 is a valid seed - Rolling a six-sided die with
Math.floor(rng() * 6) must come out close to fair, not skewed to some faces