示例#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)))
}
示例#2
0
文件: randist.go 项目: postfix/gsl-1
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)))
}
示例#3
0
文件: gamma.go 项目: mingzhi/gsl-cgo
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
}