commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject [math] Improving tests and performance of RandomGenerator implementations
Date Mon, 01 Aug 2011 05:17:15 GMT
In my own applications, I noticed what appears to be poor
performance in the nextInt(int) method of the Mersenne twister,
which I was using to *improve* speed.  I think that for small n, the
default implementation in BistreamGenerator may be running too many
iterations.  I am still figuring out how the code works, but I
thought it would be good to run some benchmarks - using Gilles' new
stuff - against the Harmony implementation in java.util.Random of
this method.  That led me to notice that there are no unit tests for
BitstreamGenerator.  I propose that we add
 0) RandomGeneratorAbstractTest with an abstract makeGenerator
method including fixed seed tests for all RandomGenerator methods
 1) BitstreamGeneratorTest extending RandomGeneratorAbstractTest
implementing makeGenerator with a BitStreamGenerator that uses the
JDK generator for next(int)
 2) Make the test classes for Mersenne and Weil generators extend
RandomGeneratorAbstractTest, moving redundant tests up into the base
class

Sound reasonable?  Also, any recollection why we are using a
different implementation in BitStreamGenerator for next(int) than
Harmony and the JDK use?  The Harmony impl is almost identical to
what is documented in the JDK javadoc.

Phil

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


Mime
View raw message