|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
245 bytes
|
| Rev | Line | |
|---|
| [e4c61dd] | 1 | // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
|
|---|
| 2 | const a = 1664525;
|
|---|
| 3 | const c = 1013904223;
|
|---|
| 4 | const m = 4294967296; // 2^32
|
|---|
| 5 |
|
|---|
| 6 | export default function() {
|
|---|
| 7 | let s = 1;
|
|---|
| 8 | return () => (s = (a * s + c) % m) / m;
|
|---|
| 9 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.