On 07/11/2015 09:43 PM, Phil Steitz wrote: > On 7/11/15 12:29 PM, Thomas Neidhart 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 > > Do you think it *should* be a private method of the K-S class?
Right now, I do not see much uses outside the class, but if we decide to make it public then I would prefer a special util class in the random package to avoid cluttering the MathArrays class. Regarding the RandomDataGenerator: I think this class should be deprecated and replaced by a Sampler interface as proposed by Gilles. One can then create a sampler for any distribution or from other sources, e.g. when needing a fast and efficient sampler without replacement (see MATH-1239). I did not have time to complete a patch, but am working on it. Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org