示例#1
0
// Set initializes (or ‘seeds’) the random number generator. If the
// generator is seeded with the same value of seed on two different runs,
// the same stream of random numbers will be generated by successive calls
// to the routines below. If different values of seed ≥ 1 are supplied,
// then the generated streams of random numbers should be completely
// different. If the seed seed is zero then the standard seed from the
// original implementation is used instead. For example, the original
// Fortran source code for the ranlux generator used a seed of 314159265,
// and so choosing seed equal to zero reproduces this when using
// gsl_rng_ranlux.
//
// When using multiple seeds with the same generator, choose seed values
// greater than zero to avoid collisions with the default setting.
// Note that the most generators only accept 32-bit seeds, with higher
// values being reduced modulo 2^32 . For generators with smaller ranges
// the maximum seed value will typically be lower.
func (s *RngState) Set(seed uint64) {
	C.gsl_rng_set(s.state, C.ulong(seed))
}
示例#2
0
func setSeed(r *C.gsl_rng, seed C.ulong) {
	C.gsl_rng_set(r, seed)
}
示例#3
0
文件: rng.go 项目: postfix/gsl-1
func Set(r *GslRng, s int) {
	C.gsl_rng_set((*C.gsl_rng)(unsafe.Pointer(r.Ptr())), C.ulong(s))
}
示例#4
0
文件: random.go 项目: npadmana/gslgo
// Seed seeds the random number generator
func (r *RNG) Seed(s int64) {
	C.gsl_rng_set(r.rng, C.ulong(s))
}