/* * Generate a lognormal distribution with the given shape and scale * parameters. */ double rds_lognormal( mt_state * state, /* State of the MT PRNG to use */ double shape, /* Shape of the distribution */ double scale) /* Scale of the distribution */ { return exp(rds_normal(state, scale, shape)); }
int cvar_next_value(void *cvar_handle, double *value) { handle_t *h = (handle_t *) cvar_handle; if (!h) { cvar_trace("NULL cvar_handle"); return -1; } if (!value) { cvar_trace("NULL value"); return -1; } *value = rds_normal(&h->state, h->mean, h->sigma); return 0; }
/* * Generate a normal distribution with the given mean and standard * deviation. See Law and Kelton, p. 491. */ double rd_normal( double mean, /* Mean of generated distribution */ double sigma) /* Standard deviation to generate */ { return rds_normal (&mt_default_state, mean, sigma); }