Last active
February 7, 2021 18:29
-
-
Save jaburns/6ea2bbd4333d93748ff033f47e3096b7 to your computer and use it in GitHub Desktop.
Linear congruential random-number generator.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const M = 4294967296; | |
const A = 1664525; | |
const C = 1013904223; | |
// seed is an integer in the range [0, M) | |
const next = seed => (A * seed + C) % M; | |
const value = seed => seed / M; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment