Exemplo n.º 1
0
func MakeImageID() string {
	mt := mt19937.New()
	mt.Seed(time.Now().UnixNano())
	var buf = make([]byte, 8)
	binary.BigEndian.PutUint64(buf, mt.Uint64())
	return strings.ToUpper(hex.EncodeToString(buf))
}
func generate() chan string {
	ch := make(chan string)
	go func() {
		var zundoko = [2]string{zun, doko}
		r := rand.New(mt19937.New())
		r.Seed(time.Now().UnixNano())
		for {
			ch <- zundoko[r.Intn(2)]
		}
	}()
	return ch
}
Exemplo n.º 3
0
func main() {
	num := flag.Int64("num", 0, "number of numbers")
	max := flag.Int64("max", 0, "max number")
	flag.Parse()

	r := rand.New(mt19937.New())
	r.Seed(1)

	i := int64(0)
	for i = 0; i < *num; i++ {
		fmt.Printf("%d\n", r.Int63n(*max+1))
	}

	return
}
Exemplo n.º 4
0
func init() {
	rng = SafeRNG{rand.New(mt19937.New())}
	rng.rng.Seed(time.Now().UnixNano())
	lock = sync.Mutex{}
}
Exemplo n.º 5
0
func main() {
	rng := rand.New(mt19937.New())
	rng.Seed(time.Now().UnixNano())
	fmt.Println(rng.NormFloat64())
}