commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ole Ersoy <ole.er...@gmail.com>
Subject Re: [math] random boolean arrays
Date Sat, 11 Jul 2015 20:38:09 GMT
How about a Randomize utility class?

Cheers,
- Ole



On 07/11/2015 02:40 PM, sebb wrote:
> On 11 July 2015 at 20:29, Thomas Neidhart <thomas.neidhart@gmail.com> wrote:
>> On 07/11/2015 09:08 PM, Phil Steitz wrote:
>>> The code implemented in MATH-1242 to improve performance of KS
>>> monteCarloP in-lines efficient generation of random boolean arrays.
>>>    Unfortunately, I think the implementation is not quite random (see
>>> comments on the ticket).  To verify it, we need to be able to test
>>> the random boolean array generation directly.  To do that, we have
>>> to either expose the method (at least as protected) in the KS class
>>> or add it somewhere else.  I propose the latter but am not sure
>>> where to put it.  For speed, we need to avoid array copies, so the
>>> API will have to be something like randomize(boolean[], nTrue).  It
>>> could go in the swelling MathArrays class, or RandomDataGenerator.
>>> The latter probably makes more sense, but the API does not fit too
>>> well.  Any ideas?
>> If it is just for testing purposes, you can also access the method in
>> question via reflection, see an example here:
>> http://stackoverflow.com/questions/34571/how-to-test-a-class-that-has-private-methods-fields-or-inner-classes
> Or make it package-protected (with a comment saying why this was done)
> and create the unit test in the same package.
>
> If the tests really need to go in a different package, then add a
> public access method in the test class in the same package
>
>> Thomas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
> .
>


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


Mime
View raw message