Simple pseudorandom number generator with seed replace the Math random for testing custom random that can be seeded for repeatability let random function 0 0 to 1 0 let x 2000 return next function x x 16807 2147483647 return x 1 2147483646 return Math random reset seed x seed 0 random reset 2 set the seed console log random next console log random next
x 16807 2147483647 return x 1 2147483646 return Math random reset seed x seed 0 random reset 2 set the seed console log random next console log random next