You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
245 B
9 lines
245 B
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
|
|
const a = 1664525;
|
|
const c = 1013904223;
|
|
const m = 4294967296; // 2^32
|
|
|
|
export default function() {
|
|
let s = 1;
|
|
return () => (s = (a * s + c) % m) / m;
|
|
}
|
|
|