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

public Interface RandomGenerator

Known Direct Implementers
org.apache.commons.math3.random.AbstractRandomGenerator, org.apache.commons.math3.random.BitsStreamGenerator, org.apache.commons.math3.random.JDKRandomGenerator, org.apache.commons.math3.random.RandomAdaptor, org.apache.commons.math3.random.SynchronizedRandomGenerator

Interface extracted from java.util.Random. This interface is implemented by AbstractRandomGenerator.
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence
nextBoolean
()

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

public void
nextBytes(byte[]
the non-null byte array in which to put the random bytes
bytes
)

Generates random bytes and places them into a user-supplied byte array.

public double

Returns:

the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence
nextDouble
()

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

public float

Returns:

the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence
nextFloat
()

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

public double

Returns:

the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence
nextGaussian
()

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

public int

Returns:

the next pseudorandom, uniformly distributed int value from this random number generator's sequence
nextInt
()

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.

public int

Returns:

a pseudorandom, uniformly distributed int value between 0 (inclusive) and n (exclusive).
nextInt
(int
the bound on the random number to be returned. Must be positive.
n
)

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

public long

Returns:

the next pseudorandom, uniformly distributed long value from this random number generator's sequence
nextLong
()

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

public void
setSeed(int
the seed value
seed
)

Sets the seed of the underlying random number generator using an int seed.

public void
setSeed(int[]
the seed value
seed
)

Sets the seed of the underlying random number generator using an int array seed.

public void
setSeed(long
the seed value
seed
)

Sets the seed of the underlying random number generator using a long seed.

Method Detail

nextBooleanback to summary
public boolean nextBoolean()

Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

Returns:boolean

the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence

nextBytesback to summary
public void nextBytes(byte[] bytes)

Generates random bytes and places them into a user-supplied byte array. The number of random bytes produced is equal to the length of the byte array.

Parameters
bytes:byte[]

the non-null byte array in which to put the random bytes

nextDoubleback to summary
public double nextDouble()

Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Returns:double

the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence

nextFloatback to summary
public float nextFloat()

Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

Returns:float

the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence

nextGaussianback to summary
public double nextGaussian()

Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

Returns:double

the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence

nextIntback to summary
public int nextInt()

Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. All 232 possible int values should be produced with (approximately) equal probability.

Returns:int

the next pseudorandom, uniformly distributed int value from this random number generator's sequence

nextIntback to summary
public int nextInt(int n)

Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

Parameters
n:int

the bound on the random number to be returned. Must be positive.

Returns:int

a pseudorandom, uniformly distributed int value between 0 (inclusive) and n (exclusive).

Exceptions
IllegalArgumentException:
if n is not positive.
nextLongback to summary
public long nextLong()

Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. All 264 possible long values should be produced with (approximately) equal probability.

Returns:long

the next pseudorandom, uniformly distributed long value from this random number generator's sequence

setSeedback to summary
public void setSeed(int seed)

Sets the seed of the underlying random number generator using an int seed.

Sequences of values generated starting with the same seeds should be identical.

Parameters
seed:int

the seed value

setSeedback to summary
public void setSeed(int[] seed)

Sets the seed of the underlying random number generator using an int array seed.

Sequences of values generated starting with the same seeds should be identical.

Parameters
seed:int[]

the seed value

setSeedback to summary
public void setSeed(long seed)

Sets the seed of the underlying random number generator using a long seed.

Sequences of values generated starting with the same seeds should be identical.

Parameters
seed:long

the seed value