3 ms·
RNGs are like crypto: don't roll your own! There's some really deep number theory behind many of them. Every RNG I've seen lets you control the seed, so I'm not
by soVeryTired 7y ago
RNGs are like crypto: don't roll your own! There's some really deep number theory behind many of them. Every RNG I've seen lets you control the seed, so I'm not sure what he gains by writing his own.
- ChrisSD 7y agoJavascript doesn't allow setting the seed: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- soVeryTired 7y agoYikes!
- strenholme 7y agoProbably time to use a third party RNG for Javascript then. For example, https://gist.github.com/banksean/300494 https://gist.github.com/banksean/300494 or, if you don’t like MT19937 (shameless plug) https://github.com/samboy/rg32hash/blob/master/rg32.js https://github.com/samboy/rg32hash/blob/master/rg32.js