Various Random things (Was: Java 8 RFC 7189139: BigInteger's staticRandom field can be a source of bottlenecks)

Brian Burkhalter brian.burkhalter at
Tue Sep 3 23:52:04 UTC 2013

On Sep 3, 2013, at 4:46 PM, Doug Lea wrote:

> I assume you mean to change line 898:
>        if (rnd == null) {
>            rnd = ThreadLocalRandom.current();; // was: getSecureRandom();
>        }


> This seems fine in terms of sufficient RNG quality and better
> performance. Also in terns of being for sure thread-safe
> even though it uses no locks/sync: there are no possible async
> or parallel calls from entry into this method, so using
> thread-local one is fine.

Thanks for the comments. One question I have is whether this change would still be needed if

public boolean isProbablePrime(int certainty, Random rnd) {}

were added.


More information about the core-libs-dev mailing list