source:
node_modules/d3-force/src/lcg.js@
e4c61dd
| Last change on this file since e4c61dd was e4c61dd, checked in by , 6 months ago | |
|---|---|
|
|
| File size: 245 bytes | |
| Line | |
|---|---|
| 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.
