RFR: 8294693: Add Collections.shuffle overload that accepts RandomGenerator interface [v3]

Stuart Marks smarks at openjdk.org
Wed Jan 4 21:34:53 UTC 2023


On Sat, 3 Dec 2022 08:23:34 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:

>> Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixes according to review
>>   
>>   1. Reduce duplication in tests
>>   2. Use JumpableGenerator#copy() instead of create(1) in tests, as according to the spec, seed can be ignored
>>   3. Simplify documentation for shuffle(List, Random) to avoid duplication.
>
> A gentle ping: please review the change and the CSR. Thanks.

@amaembo a couple comments on the test.

The test should probably have `@key randomness` added to it.

On 2022-10-28, @bplb wrote:
> jdk.test.lib.RandomFactory can be used to generate a reproducible sequence of random numbers. An example of its use may be seen for example in java/nio/file/Files/CopyAndMove.java

This bit of the test library is useful if the test is testing a random subset of the state space. It prints out the random seed on each run so that if one of the test cases fails, it's possible to reproduce it by supplying the same seed. However, it's restricted to Random and SplittableRandom, and we want to test something like Xoshiro256PlusPlus that is a RandomGenerator but not a Random. So maybe this test library can't be applied. However, take a look and see if you think it might be useful to use it.

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

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


More information about the core-libs-dev mailing list