There are already cases where code needs to control the seed (mostly to serialize/deserialize the exact state of an object). I don't think that's the issue per se? The issue is when an RNG lives beyond one test, and there are legitimate reasons that may be so.
I don't see how a getTestRandom() method fixes something... I can't call this in my non-test code, and then tests can't control those RNGs. The non-test code can't make this decision which is why they don't. I don't think this is the problem/solution but rather having a way to globally reset all RNGs. On Mon, Jan 18, 2010 at 1:55 AM, Drew Farris <drew.far...@gmail.com> wrote: > The potential issue I see is if any tests expected to run using a seed >>other< than the test seed. Now that we are no longer forking, calling > RandomUtils.useTestSeed() in test A will cause the test seed to be > used in B, C, D, E etc. In this case it makes sense to avoid using a > stateful static classes like RandomUtils, probably to condense this > down to RandomUtils.getTestRandom(). > > RandomUtils.getRandom() will reset the seed in any case, to a default > seed if useTestSeed() as ever been called, to something random if > useTestSeed() has never been called. >