public class DefaultRandom extends Object implements Random, org.apache.commons.math3.random.RandomGenerator
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.math3.random.RandomGenerator |
randomGenerator |
protected long |
seed |
| Constructor and Description |
|---|
DefaultRandom()
Initialize with a System.currentTimeMillis()
seed
|
DefaultRandom(long seed) |
DefaultRandom(org.apache.commons.math3.random.RandomGenerator randomGenerator) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
org.apache.commons.math3.random.RandomGenerator |
getRandomGenerator() |
long |
getSeed()
Gets the
long seed of the underlying
random number generator. |
DataBuffer |
getStateBuffer()
This method returns pointer to RNG buffer
|
org.bytedeco.javacpp.Pointer |
getStatePointer()
This method returns pointer to RNG state structure.
|
boolean |
nextBoolean()
Returns the next pseudorandom, uniformly distributed
boolean value from this random number generator's
sequence. |
void |
nextBytes(byte[] bytes)
Generates random bytes and places them into a user-supplied
byte array.
|
double |
nextDouble()
Returns the next pseudorandom, uniformly distributed
double value between 0.0 and
1.0 from this random number generator's sequence. |
INDArray |
nextDouble(char order,
int[] shape)
Generate a uniform number ndarray
of the specified shape and order
|
INDArray |
nextDouble(int[] shape)
Generate a uniform number ndarray
of the specified shape
|
float |
nextFloat()
Returns the next pseudorandom, uniformly distributed
float
value between 0.0 and 1.0 from this random
number generator's sequence. |
INDArray |
nextFloat(char order,
int[] shape)
Generate a uniform number ndarray
of the specified shape
|
INDArray |
nextFloat(int[] shape)
Generate a uniform number ndarray
of the specified shape
|
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. |
INDArray |
nextGaussian(char order,
int[] shape)
Generate a gaussian number ndarray
of the specified shape and order
|
INDArray |
nextGaussian(int[] shape)
Generate a gaussian number ndarray
of the specified shape
|
int |
nextInt()
Returns the next pseudorandom, uniformly distributed
int
value from this random number generator's sequence. |
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.
|
INDArray |
nextInt(int[] shape)
Generate a random set of integers
of the specified shape.
|
INDArray |
nextInt(int n,
int[] shape)
Generate a random set of integers
of the specified shape.
|
long |
nextLong()
Returns the next pseudorandom, uniformly distributed
long
value from this random number generator's sequence. |
void |
reSeed()
Identical to setSeed(System.currentTimeMillis());
|
void |
reSeed(long seed)
Identical to setSeed(seed);
|
void |
setSeed(int seed)
Sets the seed of the underlying random number generator using an
int seed. |
void |
setSeed(int[] seed)
Sets the seed of the underlying random number generator using an
int seed. |
void |
setSeed(long seed)
Sets the seed of the underlying random number generator using a
long seed. |
protected org.apache.commons.math3.random.RandomGenerator randomGenerator
protected long seed
public DefaultRandom()
public DefaultRandom(long seed)
public DefaultRandom(org.apache.commons.math3.random.RandomGenerator randomGenerator)
public void setSeed(int seed)
Randomint seed.
Sequences of values generated starting with the same seeds should be identical.
public void setSeed(int[] seed)
Randomint seed.
Sequences of values generated starting with the same seeds should be identical.
public void setSeed(long seed)
Randomlong seed.
Sequences of values generated starting with the same seeds should be identical.
public void nextBytes(byte[] bytes)
Randompublic int nextInt()
Randomint
value from this random number generator's sequence.
All 232 possible int values
should be produced with (approximately) equal probability.public int nextInt(int n)
RandomnextInt in interface org.apache.commons.math3.random.RandomGeneratornextInt in interface Randomn - the bound on the random number to be returned. Must be
positive.public long nextLong()
Randomlong
value from this random number generator's sequence. All
264 possible long values
should be produced with (approximately) equal probability.public boolean nextBoolean()
Randomboolean value from this random number generator's
sequence.nextBoolean in interface org.apache.commons.math3.random.RandomGeneratornextBoolean in interface Randomboolean value from this random number generator's
sequencepublic float nextFloat()
Randomfloat
value between 0.0 and 1.0 from this random
number generator's sequence.public double nextDouble()
Randomdouble value between 0.0 and
1.0 from this random number generator's sequence.nextDouble in interface org.apache.commons.math3.random.RandomGeneratornextDouble in interface Randomdouble value between 0.0 and
1.0 from this random number generator's sequencepublic double nextGaussian()
Randomdouble value with mean 0.0 and standard
deviation 1.0 from this random number generator's sequence.nextGaussian in interface org.apache.commons.math3.random.RandomGeneratornextGaussian in interface Randomdouble value with mean 0.0 and
standard deviation 1.0 from this random number
generator's sequencepublic INDArray nextGaussian(int[] shape)
RandomnextGaussian in interface Randomshape - the shape to generatepublic INDArray nextGaussian(char order, int[] shape)
RandomnextGaussian in interface Randomorder - the order of the output arrayshape - the shape to generatepublic INDArray nextDouble(int[] shape)
RandomnextDouble in interface Randomshape - the shape to generatepublic INDArray nextDouble(char order, int[] shape)
RandomnextDouble in interface Randomorder - order of the output arrayshape - the shape to generatepublic INDArray nextFloat(int[] shape)
Randompublic INDArray nextFloat(char order, int[] shape)
Randompublic INDArray nextInt(int[] shape)
Randompublic INDArray nextInt(int n, int[] shape)
Randompublic org.apache.commons.math3.random.RandomGenerator getRandomGenerator()
public long getSeed()
Randomlong seed of the underlying
random number generator.public org.bytedeco.javacpp.Pointer getStatePointer()
getStatePointer in interface Randompublic DataBuffer getStateBuffer()
getStateBuffer in interface Randompublic void close()
throws Exception
close in interface AutoCloseableExceptionpublic void reSeed()
Copyright © 2018. All rights reserved.