Struct rgsl::types::ran_discrete::RanDiscrete [] [src]

pub struct RanDiscrete { /* fields omitted */ }

Methods

impl RanDiscrete
[src]

This function returns a pointer to a structure that contains the lookup table for the discrete random number generator. The array P[] contains the probabilities of the discrete events; these array elements must all be positive, but they needn’t add up to one (so you can think of them more generally as “weights”)—the preprocessor will normalize appropriately. This return value is used as an argument for the gsl_ran_discrete function below.

After the new, above, has been called, you use this function to get the discrete random numbers.

Returns the probability P[k] of observing the variable k. Since P[k] is not stored as part of the lookup table, it must be recomputed; this computation takes O(K), so if K is large and you care about the original array P[k] used to create the lookup table, then you should just keep this original array P[k] around.

Trait Implementations

impl Drop for RanDiscrete
[src]

A method called when the value goes out of scope. Read more