RFR 8024253: ThreadLocal random can use SecureRandom for the initial seed

Paul Sandoz paul.sandoz at oracle.com
Tue Sep 17 05:21:28 UTC 2013


On Sep 17, 2013, at 1:22 AM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 09/16/2013 02:11 PM, Guy Steele wrote:
> 
>> Okay, as long as we're obsessing: the code defends against the hardware
>> address being longer than 8 bytes.
> 
> This was to protect ourselves from the impact of this code being used in some
> alternative universe in which hardware addresses are not always 48bits.
> But you are right that we could do a little better.
> 
>> So how about this code?
>> ...
>>                           h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
> 
> On first glance the sign extension of byte to long conversion
> makes this suspicious, but I see that it cannot hurt.
> So, sure; thanks.
> 
> Here's the full current version, including another minor tweak.
> (Paul: I'm committing to our CVS.)
> 

OK, i will sync this and SplittableRandom this week, and probably switch myself to a reviewer to speed this up.

Paul.


More information about the core-libs-dev mailing list