[Webkit-unassigned] [Bug 157805] REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue May 17 13:33:10 PDT 2016
https://bugs.webkit.org/show_bug.cgi?id=157805
--- Comment #5 from Joseph Pecoraro <joepeck at webkit.org> ---
(In reply to comment #3)
> Probably too many zeroes in the initial seed, since our seed API is 32 bit.
> You can probably fix this by:
>
> uint64_t seed64 = seed;
> m_low = (seed64 << 32) | seed64;
> m_high = (seed64 << 32) | seed64;
>
After this the first 4 digits stayed nearly identical:
>>> Math.random()
0.41647092963078913
>>> Math.random()
0.41646612834590113
>>> Math.random()
0.47840231815551537
>>> Math.random()
0.47839187513838377
How about we just advance once after setting the seed?
m_low = seed;
m_high = seed;
advance();
Do you see any disadvantages to this?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160517/4e1755d0/attachment.html>
More information about the webkit-unassigned
mailing list