org.spaceroots.mantissa.random
Class UniformRandomGenerator
- java.lang.Object
-
- org.spaceroots.mantissa.random.UniformRandomGenerator
-
- All Implemented Interfaces:
- java.io.Serializable, NormalizedRandomGenerator
public class UniformRandomGenerator extends java.lang.Object implements NormalizedRandomGenerator
This class implements a normalized uniform random generator.Since this is a normalized random generator, it has a null mean and a unit standard deviation. Beeing also a uniform generator, it produces numbers in the range [-sqrt(3) ; sqrt(3)]. It uses the
MersenneTwistergenerator as the underlying generator.- See Also:
MersenneTwister, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description UniformRandomGenerator()Create a new generator.UniformRandomGenerator(int seed)Creates a new random number generator using a single int seed.UniformRandomGenerator(int[] seed)Creates a new random number generator using an int array seed.UniformRandomGenerator(long seed)Create a new generator initialized with a single long seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublenextDouble()Generate a random scalar with null mean and unit standard deviation.
-
-
-
Constructor Detail
-
UniformRandomGenerator
public UniformRandomGenerator()
Create a new generator. The seed of the generator is related to the current time.
-
UniformRandomGenerator
public UniformRandomGenerator(int seed)
Creates a new random number generator using a single int seed.- Parameters:
seed- the initial seed (32 bits integer)
-
UniformRandomGenerator
public UniformRandomGenerator(int[] seed)
Creates a new random number generator using an int array seed.- Parameters:
seed- the initial seed (32 bits integers array), if null the seed of the generator will be related to the current time
-
UniformRandomGenerator
public UniformRandomGenerator(long seed)
Create a new generator initialized with a single long seed.- Parameters:
seed- seed for the generator (64 bits integer)
-
-
Method Detail
-
nextDouble
public double nextDouble()
Generate a random scalar with null mean and unit standard deviation.The number generated is uniformly distributed between -sqrt(3) and sqrt(3).
- Specified by:
nextDoublein interfaceNormalizedRandomGenerator- Returns:
- a random scalar with null mean and unit standard deviation
-
-
DataMelt 3.0 © DataMelt by jWork.ORG