Top Description Fields Constructors Methods
org.apache.commons.math3.random

public Class Well19937c

extends AbstractWell
Class Inheritance

This class implements the WELL19937c pseudo-random number generator from François Panneton, Pierre L'Ecuyer and Makoto Matsumoto.

This generator is described in a paper by François Panneton, Pierre L'Ecuyer and Makoto Matsumoto Improved Long-Period Generators Based on Linear Recurrences Modulo 2 ACM Transactions on Mathematical Software, 32, 1 (2006). The errata for the paper are in wellrng-errata.txt.

Since
2.2
See Also
WELL Random number generator

Field Summary

Modifier and TypeField and Description
private static final int
K

Number of bits in the pool.

private static final int
M1

First parameter of the algorithm.

private static final int
M2

Second parameter of the algorithm.

private static final int
M3

Third parameter of the algorithm.

private static final long
Inherited from org.apache.commons.math3.random.AbstractWell:
i1i2i3indexiRm1iRm2v

Constructor Summary

AccessConstructor and Description
public
Well19937c()

Creates a new random number generator.

public
Well19937c(int
the initial seed (32 bits integer)
seed
)

Creates a new random number generator using a single int seed.

public
Well19937c(int[]
the initial seed (32 bits integers array), if null the seed of the generator will be related to the current time
seed
)

Creates a new random number generator using an int array seed.

public
Well19937c(long
the initial seed (64 bits integer)
seed
)

Creates a new random number generator using a single long seed.

Method Summary

Modifier and TypeMethod and Description
protected int
next(final int
number of random bits to produce
bits
)

Implements abstract org.apache.commons.math3.random.AbstractWell.next.

Generate next pseudorandom number.

Inherited from org.apache.commons.math3.random.AbstractWell:
setSeedsetSeedsetSeed

Field Detail

Kback to summary
private static final int K

Number of bits in the pool.

M1back to summary
private static final int M1

First parameter of the algorithm.

M2back to summary
private static final int M2

Second parameter of the algorithm.

M3back to summary
private static final int M3

Third parameter of the algorithm.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.commons.math3.random.AbstractWell.serialVersionUID.

Serializable version identifier.

Constructor Detail

Well19937cback to summary
public Well19937c()

Creates a new random number generator.

The instance is initialized using the current time as the seed.

Well19937cback to summary
public Well19937c(int seed)

Creates a new random number generator using a single int seed.

Parameters
seed:int

the initial seed (32 bits integer)

Well19937cback to summary
public Well19937c(int[] seed)

Creates a new random number generator using an int array seed.

Parameters
seed:int[]

the initial seed (32 bits integers array), if null the seed of the generator will be related to the current time

Well19937cback to summary
public Well19937c(long seed)

Creates a new random number generator using a single long seed.

Parameters
seed:long

the initial seed (64 bits integer)

Method Detail

nextback to summary
protected int next(final int bits)

Implements abstract org.apache.commons.math3.random.AbstractWell.next.

Doc from org.apache.commons.math3.random.AbstractWell.next.

Generate next pseudorandom number.

This method is the core generation algorithm. It is used by all the public generation methods for the various primitive types nextBoolean(), nextBytes(byte[]), nextDouble(), nextFloat(), nextGaussian(), nextInt(), next(int) and nextLong().

Parameters
bits:int

Doc from org.apache.commons.math3.random.BitsStreamGenerator.next.

number of random bits to produce

Returns:int

Doc from org.apache.commons.math3.random.BitsStreamGenerator.next.

random bits generated

Annotations
@Override