Class edu.cornell.lassp.houle.RngPack.RandomElement
All Packages Class Hierarchy This Package Previous Next Index
Class edu.cornell.lassp.houle.RngPack.RandomElement
java.lang.Object
|
+----edu.cornell.lassp.houle.RngPack.RandomElement
- public class RandomElement
- extends Object
RandomElement is an abstract class that encapsulates random number
generators. To base a class on it, you must define the method raw,
described below, as well as defining a constructor to initialize or
seed the generator.
Other classes defined in RandomElement add value to the random
numbers generated by raw().
Source code is available.
- Version:
- 0.9a
- Author:
- Paul Houle (E-mail: ph18@cornell.edu)
- See Also:
- RandomJava, RandomShuffle
-
RandomElement()
-
-
choose(int)
-
-
choose(int, int)
-
-
gaussian()
-
gaussian() uses the Box-Muller algorithm to transform raw()'s into
gaussian deviates.
-
gaussian(double)
-
-
raw()
- The abstract method that must be defined to make a working RandomElement.
-
uniform(double, double)
-
RandomElement
public RandomElement()
raw
public abstract double raw()
- The abstract method that must be defined to make a working RandomElement.
See the class RandomJava for an example of how to do this.
- Returns:
- a random double in the range [0,1]
- See Also:
- RandomJava
choose
public int choose(int hi)
- Parameters:
- hi - upper limit of range
- Returns:
- a random integer in the range 1,2,... ,hi
choose
public int choose(int lo,
int hi)
- Parameters:
- lo - lower limit of range
- hi - upper limit of range
- Returns:
- a random integer in the range lo, lo+1, ... ,hi
uniform
public double uniform(double lo,
double hi)
- Parameters:
- lo - lower limit of range
- hi - upper limit of range
- Returns:
- a uniform random real in the range [lo,hi]
gaussian
public double gaussian()
- gaussian() uses the Box-Muller algorithm to transform raw()'s into
gaussian deviates.
- Returns:
- a random real with a gaussian distribution, standard deviation
gaussian
public double gaussian(double sd)
- Parameters:
- sd - standard deviation
- Returns:
- a gaussian distributed random real with standard deviation sd
All Packages Class Hierarchy This Package Previous Next Index