stevenschlansker at gmail.com
Wed Oct 18 22:25:54 UTC 2017
> On Oct 18, 2017, at 3:15 PM, Martin Buchholz <martinrb at google.com> wrote:
> Why not SplittableRandom?
In this particular case, an algorithm written by a library vendor takes a parameter of type Random.
SplittableRandom is not a Random. I'm guessing this is because it is not thread-safe like the Random
We were hoping to have a single sequence shared between the library that takes Random and our
own code that hopes to generate bounded longs. We want such tight control because we are writing
a repeatable tester and want to use the seed to be able to replay sequences that cause our
system to fail.
We are looking into somehow retrofitting our code to use SplittableRandom but it's likely less
complex for us to just implement the naïve re-roll algorithm [ while(sample >= bound) sample = nextLong(); ]
I don't think this will turn into a total blocker for us, you're correct -- we'll find a path forward.
But I do think it highlights missing functionality, and the SO post highlights that this is a problem 'in the wild'.
It feels like an obvious omission!
More information about the core-libs-dev