Replaces Math.random() with a PRNG that's seedable.