Class ExtendedPseudoRandomGenerator
java.lang.Object
org.uma.jmetal.util.pseudorandom.impl.ExtendedPseudoRandomGenerator
- All Implemented Interfaces:
Serializable,PseudoRandomGenerator
Extended pseudo random number generator based on the decorator pattern.
Two new methods are added: randNormal() and randSphere()
- Author:
- Antonio J. Nebro
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()longgetSeed()doubledoublenextDouble(double lowerBound, double upperBound) intnextInt(int lowerBound, int upperBound) doublerandNormal(double mean, double standardDeviation) Use the polar form of the Box-Muller transformation to obtain a pseudo random number from a Gaussian distribution Code taken from Maurice Clerc's implementationdouble[]randSphere(int dimension) Get a random point from an hypersphere (center = 0, radius = 1) Code taken from Maurice Clerc's implementationdouble[]randSphere(int dimension, double center, double radius) Ger a random point from an hypersphere Code taken from Maurice Clerc's implementationvoidsetSeed(long seed)
-
Constructor Details
-
ExtendedPseudoRandomGenerator
-
-
Method Details
-
nextInt
public int nextInt(int lowerBound, int upperBound) - Specified by:
nextIntin interfacePseudoRandomGenerator
-
nextDouble
public double nextDouble(double lowerBound, double upperBound) - Specified by:
nextDoublein interfacePseudoRandomGenerator
-
nextDouble
public double nextDouble()- Specified by:
nextDoublein interfacePseudoRandomGenerator
-
setSeed
public void setSeed(long seed) - Specified by:
setSeedin interfacePseudoRandomGenerator
-
getSeed
public long getSeed()- Specified by:
getSeedin interfacePseudoRandomGenerator
-
getName
- Specified by:
getNamein interfacePseudoRandomGenerator
-
randNormal
public double randNormal(double mean, double standardDeviation) Use the polar form of the Box-Muller transformation to obtain a pseudo random number from a Gaussian distribution Code taken from Maurice Clerc's implementation- Parameters:
mean-standardDeviation-- Returns:
- A pseudo random number
-
randSphere
public double[] randSphere(int dimension) Get a random point from an hypersphere (center = 0, radius = 1) Code taken from Maurice Clerc's implementation- Parameters:
dimension-- Returns:
- A pseudo random point
-
randSphere
public double[] randSphere(int dimension, double center, double radius) Ger a random point from an hypersphere Code taken from Maurice Clerc's implementation- Parameters:
center-radius-- Returns:
- A pseudo random number
-