Re: Collections.shuffle to accept RandomGenerator

2022-10-05 Thread John Rose
On 3 Oct 2022, at 14:32, Stuart Marks wrote: > … > The Arrays class does need some attention and probably should be considered > separately. It's lacking some other things too, like reverse(). One issue > with modifying the Arrays class is providing overloads for some or all of the > primitives

Re: Collections.shuffle to accept RandomGenerator

2022-10-03 Thread Stuart Marks
method to perform a shuffle without having to use asList. Jason From: Tagir Valeev Sent: Saturday, October 1, 2022 2:24 AM To: Jason Mehrens Cc: Paul Sandoz; core-libs-dev@openjdk.org Subject: Re: Collections.shuffle to accept RandomGenerator Thanks, Paul, Jason. I've filed an issu

Re: Collections.shuffle to accept RandomGenerator

2022-10-01 Thread Jason Mehrens
ethod to perform a shuffle without having to use asList. Jason From: Tagir Valeev Sent: Saturday, October 1, 2022 2:24 AM To: Jason Mehrens Cc: Paul Sandoz; core-libs-dev@openjdk.org Subject: Re: Collections.shuffle to accept RandomGenerator Thanks,

Re: Collections.shuffle to accept RandomGenerator

2022-10-01 Thread Tagir Valeev
> From: core-libs-dev on behalf of Paul Sandoz > > Sent: Wednesday, September 28, 2022 10:36 AM > To: Tagir Valeev > Cc: core-libs-dev@openjdk.org > Subject: Re: Collections.shuffle to accept RandomGenerator > > That looks rea

Re: Collections.shuffle to accept RandomGenerator

2022-09-28 Thread Jason Mehrens
of Paul Sandoz Sent: Wednesday, September 28, 2022 10:36 AM To: Tagir Valeev Cc: core-libs-dev@openjdk.org Subject: Re: Collections.shuffle to accept RandomGenerator That looks reasonable. Thinking a little more broadly. We could also change Collections.shuffle(List) to use ThreadLocalRandom

Re: Collections.shuffle to accept RandomGenerator

2022-09-28 Thread Paul Sandoz
That looks reasonable. Thinking a little more broadly. We could also change Collections.shuffle(List) to use ThreadLocalRandom so it does not have to cache the Random instance, plus it has better concurrent and PRNG properties. The spec does not describe the precise details of randomness. It’

Collections.shuffle to accept RandomGenerator

2022-09-27 Thread Tagir Valeev
Hello! Currently, Collections.shuffle(List, Random) accepts an outdated Random class instead of RandomGenerator interface. It looks like, RandomGenerator would suffice. The code change looks trivial (aside from documentation and testing), as shuffle() implementation does not need anything except n