[Webkit-unassigned] [Bug 36673] Math.random repeats values in different workers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Aug 30 00:12:44 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=36673


Beni Paskin-Cherniavsky <cben at users.sf.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cben at users.sf.net




--- Comment #4 from Beni Paskin-Cherniavsky <cben at users.sf.net>  2013-08-30 00:12:06 PST ---
Is this still relevant?
I think your comments refer to
https://trac.webkit.org/changeset/50789/trunk/JavaScriptCore/runtime/JSGlobalData.cpp 
but JSGlobalData.cpp has been renamed VM.cpp since and no longer includes any seeding.
Seeding WeakRandom from time was fixed in Aug 2010 in https://trac.webkit.org/changeset/65947 .

What I see now:

Math.random()
 https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/MathObject.cpp?rev=154868
calls exec->lexicalGlobalObject()->weakRandomNumber() implemented in
 https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h?rev=154868#L490
as a shallow wrapper for
 https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/WeakRandom.h

It is initialized in
 https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp?rev=154868#L138
from randomNumber():
 https://trac.webkit.org/browser/trunk/Source/WTF/wtf/RandomNumber.cpp?rev=154868
which is a shallow wrapper for cryptographicallyRandomNumber() which is a shared ARC4Random state:
 https://trac.webkit.org/browser/trunk/Source/WTF/wtf/CryptographicallyRandomNumber.cpp?rev=154868#L168
which initializes itself in ARC4RandomNumberGenerator::stir() from strong OS randomness:
 https://trac.webkit.org/browser/trunk/Source/WTF/wtf/OSRandomSource.h?rev=154868

Phew.

--

There is also
https://trac.webkit.org/browser/trunk/Source/WTF/wtf/RandomNumberSeed.h?rev=154868 
which *does* initialize on Unix from time & process id.
But what it initializes are rand()/random() which are not used in any way for Math.random() AFAICT.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list