<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations"
href="https://bugs.webkit.org/show_bug.cgi?id=157805#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - REGRESSION(r192855): Math.random() always produces the same first 7 decimal points the first two invocations"
href="https://bugs.webkit.org/show_bug.cgi?id=157805">bug 157805</a>
from <span class="vcard"><a class="email" href="mailto:joepeck@webkit.org" title="Joseph Pecoraro <joepeck@webkit.org>"> <span class="fn">Joseph Pecoraro</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=157805#c3">comment #3</a>)
<span class="quote">> 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;
> </span >
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?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>