Classes and functions for computing random sets of numbers.
Random number generator based on a modelled distribution.
Given repeated observations of a single random variable, this object first models the probability distribution that governs the variable using a histogram. It then generates new variates according to this distribution.
This sampler trades space for time by approximating the cumulative histogram as a single linear array in memory, where the value of a histogram bin is represented repeatedly according to its magnitude. New variates are generated by sampling uniformly from the indices of this array, and returning the edge value of the corresponding bin. The accuracy of the sampler is governed by both the number of bins in the histogram, and the number of elements in the cumulative distribution (cum-dist) array.
Generate variates according to the modelled distribution.
| Parameters: | size (int, or tuple of int) – Number of variates to generate. |
|---|---|
| Returns: | Generated variates. |
| Return type: | ndarray |
Construct a new sampler object.
| Parameters: |
|
|---|
Relative drop in range of values between observed and generated variates.