On Tue, 11 Oct 2022 01:56:38 GMT, Stuart Marks <sma...@openjdk.org> wrote:

>> Tagir F. Valeev has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Remove Random -> ThreadLocalRandom change
>
> test/jdk/java/util/Collections/Shuffle.java line 66:
> 
>> 64:         RandomGeneratorFactory<RandomGenerator> factory = 
>> RandomGeneratorFactory.getDefault();
>> 65:         list.sort(null);
>> 66:         Collections.shuffle(list, factory.create(1));
> 
> This assumes that the default factory will accept a seed value that 
> initializes its state so that the pseudorandom sequence is repeatable. Not an 
> unreasonable assumption, but `create(long)` essentially says that it can 
> ignore the seed, and `getDefault` says the algorithm may change over time. On 
> the other hand if something does change such that the pseudorandom sequence 
> isn't repeatable, this test will most likely fail immediately. I was poking 
> around for an explicit way to request some kind of PRNG that's guaranteed to 
> be started in repeatable state, but I couldn't find one. Hmmm.

Oh, that's an unfortunate detail, I didn't know about this. We can explicitly 
request a JumpableGenerator, like "Xoshiro256PlusPlus" and then copy it via 
`copy()` method. What do you think?

-------------

PR: https://git.openjdk.org/jdk/pull/10520

Reply via email to