**'cern.jet.random.EmpiricalWalker'**Java class

## Class EmpiricalWalker

- java.lang.Object
- cern.colt.PersistentObject
- cern.jet.random.AbstractDistribution
- cern.jet.random.AbstractDiscreteDistribution
- cern.jet.random.EmpiricalWalker

- All Implemented Interfaces:
- DoubleFunction, IntFunction, Serializable, Cloneable

public class EmpiricalWalkerextends AbstractDiscreteDistribution

Discrete Empirical distribution (pdf's can be specified).The probability distribution function (pdf) must be provided by the user as an array of positive real numbers. The pdf does not need to be provided in the form of relative probabilities, absolute probabilities are also accepted.

Instance methods operate on a user supplied uniform random number generator; they are unsynchronized.

- Static methods operate on a default uniform random number generator; they are synchronized.
**Implementation:**Walker's algorithm. Generating a random number takes`O(1)`, i.e. constant time, as opposed to commonly used algorithms with logarithmic time complexity. Preprocessing time (on object construction) is`O(k)`where`k`is the number of elements of the provided empirical pdf. Space complexity is`O(k)`.This is a port of discrete.c which was written by James Theiler and is distributed with GSL 0.4.1. Theiler's implementation in turn is based upon

Alastair J. Walker, An efficient method for generating discrete random variables with general distributions, ACM Trans Math Soft 3, 253-256 (1977).

See also: D. E. Knuth, The Art of Computer Programming, Volume 2 (Seminumerical algorithms), 3rd edition, Addison-Wesley (1997), p120.

- See Also:
- Serialized Form

**Warning:**You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.