dawid.weiss at gmail.com
Thu Oct 19 06:44:38 UTC 2017
> 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.
A repeatable randomized tester is a noble idea; have you perhaps tried
testing package (full disclosure -- I'm the author) ?
This is used in Solr/Lucene and other projects for running JUnit tests
randomness (where it's possible to assert it, of course ). The
Random instance you get from the test's context should be
predictable and has an implementation of nextLong() with a long cycle
(as pointed out, it's not the long range,
it's the rnd generator's cycle that is a problem here).
> complex for us to just implement the naïve re-roll algorithm [ while(sample >= bound) sample = nextLong(); ]
There are some utilities that should be helpful here , but
Sebastiano Vigna (dsiutil package ) has Random
implementations with very long cycles too.
More information about the core-libs-dev