class SplittableRandom

Doug Lea dl at cs.oswego.edu
Mon Jul 15 15:27:02 UTC 2013


On 07/15/13 00:24, Martin Buchholz wrote:
> Thoughts:
>
> I was sad when ThreadLocalRandom reused the lousy pseudorandom implementation
> from Random.  I continue to think we can do better.

Yes, I'm working on it.

>
> It would be nice if we could guarantee a minimum period of 2^64.

OK. I cannot think of any reason not to. Unless anyone else
can, I'll add this.

>
> Doug, you say "SplittableRandoms will tend to be short-lived." but I'm not sure
> why.

I meant "short-lived in the contexts that would otherwise lead to
memory placement issues." In other words, we hope people still use TLR,
not a thread-localized SplittableRandom, in these cases.

>
> Random provides the useful "nextBoolean" and I think SplittableRandom should too.
>

It's partway down the slippery slope of also supporting
the other java.util.Random methods we have no intention
of supporting, but I cannot see the harm.

-Doug




More information about the core-libs-dev mailing list