commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <gil...@harfang.homelinux.org>
Subject Re: [lang] Shuffling arrays
Date Tue, 27 Sep 2016 16:36:18 GMT
On Tue, 27 Sep 2016 13:57:04 +0200, Emmanuel Bourg wrote:
> Le 27/09/2016 à 13:22, Gilles a écrit :
>
>> I (strongly) suggest
>>
>>   ArraysUtils.shuffle(Object[] array, 
>> o.a.c.rng.UniformRandomProvider rnd)
>
> That's not possible, because we don't want to add external 
> dependencies
> to commons-lang.

I mistakenly thought that your examples (cf. uncut previous post) meant
that this CM-alike tradition was coming to an end...

Anyway, assuming there are still good reasons for CL to not have
dependencies[1], it is then all the more interesting that utilities
based on RNGs should have their own component.

CL would benefit (reduced codebase reduces the maintenance cost)
and users would benefit (from using better generators).

>> Moreover, the default RNG should be a good one, i.e. not
>> "java.util.Random".
>
> Using java.util.Random by default is good enough, and it's consistent
> with Collections.shuffle():
>
> 
> http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#shuffle-java.util.List-

Well, of course, the JDK utilities use the JDK's RNG.

That doesn't mean that Apache should do the same, or spread bad
practice:
   http://www0.cs.ucl.ac.uk/staff/d.jones/GoodPracticeRNG.pdf
(see page 2 about "java.util.Random").

Gilles

[1] Even if those would be in our total control!

>
> Emmanuel Bourg
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message