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

Constructor Index

 o RandomElement()

Method Index

 o choose(int)
 o choose(int, int)
 o gaussian()
gaussian() uses the Box-Muller algorithm to transform raw()'s into gaussian deviates.
 o gaussian(double)
 o raw()
The abstract method that must be defined to make a working RandomElement.
 o uniform(double, double)

Constructors

 o RandomElement
  public RandomElement()

Methods

 o 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
 o choose
  public int choose(int hi)
Parameters:
hi - upper limit of range
Returns:
a random integer in the range 1,2,... ,hi
 o 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
 o 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]
 o 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
 o 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