source:
node_modules/d3-hierarchy/src/lcg.js
| Last change on this file was e4c61dd, checked in by , 6 months ago | |
|---|---|
|
|
| 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.
