MCPcopy
hub / github.com/fent/randexp.js / prng

Function prng

test/custom-prng-test.js:7–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5// This is a simple "good enough" PRNG.
6var initialSeed = Math.random() * Math.pow(2, 32) + Date.now();
7function prng() {
8 var seed = initialSeed;
9 return (a, b) => {
10 seed = Math.pow(seed, 2) % 94906249;
11 return seed % (1 + b - a) + a;
12 };
13}
14
15describe('Modify PRNG', () => {
16 it('Should generate the same string with the same the PRNG seed', () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected