The GameRand-based RNG Safari/JSC uses is very weak. Furthermore, it only uses 32 bits of precision. I blogged about this here:
V8 moved to a better RNG and we're switching the one in SpiderMonkey as well. JSC should probably do the same.
If we really do consider more than 32bits necessary id just move up to a 64bit variant of gamerand which should not have a significant perf impact, then value & (2^53-1) / 2^53 (I can recall if the rand includes 1 as a valid result).
Has someone done something to find it's aggressively non-uniform in some space?
Created attachment 266302 [details]
I kind of wanted to stick with GameRandom in order to troll the internet commentators who keep confusing / conflating RNG algorithm with number of bits provided by RNG interface.
But there's literally no downside to upgrading to Xorshift+, so I've done it.
Comment on attachment 266302 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=266302&action=review
> + prevents programs that mulitply a random number by a large constant from
Committed r192855: <http://trac.webkit.org/changeset/192855>
(In reply to comment #3)
> I kind of wanted to stick with GameRandom in order to troll the internet
> commentators who keep confusing / conflating RNG algorithm with number of
> bits provided by RNG interface.
It's not just that; GameRand also doesn't do well in statistical tests:
No big deal probably, but it shows the algorithm has other issues.
> But there's literally no downside to upgrading to Xorshift+, so I've done it.