[Webkit-unassigned] [Bug 98586] Extend random precision to 53bits

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 7 00:50:51 PDT 2012


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





--- Comment #7 from Yusuke Suzuki <utatane.tea at gmail.com>  2012-10-07 00:51:23 PST ---
(From update of attachment 167443)
View in context: https://bugs.webkit.org/attachment.cgi?id=167443&action=review

Thanks for your review.

>>> Source/JavaScriptCore/ChangeLog:3
>>> +        Extend random precision to 53bits
>> 
>> If this creates an observable benefit, you should be able to write a regression test for it.
> 
> That said i'm more concerned about pert, as at one point I did generate 53 bits of randomness, but that got killed due to the pert cost.

We can observe Math.random().toString(2) result may become > 32 bits floating part.
But because Math.random() result is random, so test may become erratic.
I'll append test case to revised patch.

>> Source/JavaScriptCore/runtime/WeakRandom.h:71
>> +        uint32_t a = static_cast<uint32_t>(getUint32()) >> 5;
> 
> I think this would be clearer as a uint64_t.

I've got it. I'll create revised patch using uint64_t.

>> Source/JavaScriptCore/runtime/WeakRandom.h:73
>> +        uint64_t combined = (static_cast<uint64_t>(a) << 26) | b;
> 
> I think it would be clearer just to shift 'a' right by 21 and then left by 32. It's not clear what you're trying to accomplish by removing bits from both values. For example, maybe you think that increases the randomness. But if each bit is random, that's not the case.

I understand that
a = v1 >> 15;
b = v2;
combined = (a << 32) | b;

Is it right?

-- 
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