Пример #1
0
// MTinit initialises random numbers generators (Mersenne Twister code)
//  Input:
//   seed -- seed value; use seed <= 0 to use current time
func MTinit(seed int) {
	if seed <= 0 {
		seed = int(time.Now().Unix())
	}
	sfmt.Init(seed)
	dsfmt.Init(seed)
}
Пример #2
0
// Init initialises random numbers generators
//  Input:
//   seed -- seed value; use seed <= 0 to use current time
func Init(seed int) {
	if seed <= 0 {
		seed = int(time.Now().Unix())
	}
	rand.Seed(int64(seed))
	sfmt.Init(seed)
	dsfmt.Init(seed)
}