Created
June 15, 2020 08:08
-
-
Save manthrax/e0e1b8c6d081e5a1ef74721e93bb2f5a to your computer and use it in GitHub Desktop.
js wichmann hill rng.. untested.. drop in replacement for Math.random.. uses zelda ww seed by default
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
let wichmann_hill_rng = (s1=100,s2=100,s3=100)=>()=>((s1 = (171 * s1) % 30269) / 30269 + (s2 = (172 * s1) % 30307) / 30307 + (s3 = (170 * s1) % 30323) / 30323) % 1 | |
let rng = wichmann_hill_rng() | |
for (let i = 0; i < 1000; i++) console.log(rng()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment