Ejemplo n.º 1
0
// Gamma returns a random variate from the gamma distribution.
// The gamma distribution with an integer parameter a is known as the Erlang
// distribution. The variates are computed using the Marsaglia-Tsang fast gamma method.
func Gamma(rng RngState, a, b float64) float64 {
	return float64(C.gsl_ran_gamma(rng.state, C.double(a), C.double(b)))
}
Ejemplo n.º 2
0
func Gamma(r *rng.GslRng, a float64, b float64) float64 {
	return float64(C.gsl_ran_gamma((*C.gsl_rng)(unsafe.Pointer(r.Ptr())), C.double(a), C.double(b)))
}
Ejemplo n.º 3
0
func GammaRandomFloat64(rd *RNG, shape, scale float64) float64 {
	var x float64
	x = float64(C.gsl_ran_gamma(rd.g, C.double(shape), C.double(scale)))
	return x
}