MATH-1307

Extends new base class.
This commit is contained in:
Gilles 2015-12-28 16:49:55 +01:00
parent 87497c7246
commit 921d0d60d4
2 changed files with 7 additions and 5 deletions

View File

@ -41,9 +41,11 @@ import org.apache.commons.math4.util.FastMath;
* *
* @since 3.0 * @since 3.0
*/ */
public class ISAACRandom extends BitsStreamGenerator implements Serializable { public class ISAACRandom
extends BaseRandomGenerator
implements Serializable {
/** Serializable version identifier */ /** Serializable version identifier */
private static final long serialVersionUID = 7288197941165002400L; private static final long serialVersionUID = 20151227L;
/** Log of size of rsl[] and mem[] */ /** Log of size of rsl[] and mem[] */
private static final int SIZE_L = 8; private static final int SIZE_L = 8;
/** Size of rsl[] and mem[] */ /** Size of rsl[] and mem[] */
@ -138,12 +140,12 @@ public class ISAACRandom extends BitsStreamGenerator implements Serializable {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected int next(int bits) { public int nextInt() {
if (count < 0) { if (count < 0) {
isaac(); isaac();
count = SIZE - 1; count = SIZE - 1;
} }
return rsl[count--] >>> 32 - bits; return rsl[count--];
} }
/** Generate 256 results */ /** Generate 256 results */

View File

@ -22,7 +22,7 @@ import org.apache.commons.math4.random.RandomGenerator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public final class ISAACTest extends RandomGeneratorAbstractTest { public final class ISAACTest extends BaseRandomGeneratorTest {
@Override @Override
protected RandomGenerator makeGenerator() { protected RandomGenerator makeGenerator() {