On Monday, 8 May 2017 15:51:00 UTC+2, Shabinesh Sivaraj wrote: > > func xrand() int { > r := rand.New(rand.NewSource(99)) > return r.Int() > } > What am I missing here? Could it be a bug? >
Not a bug. r := rand.New(rand.NewSource(99)) creates a new random number generator seeded to a constant value of 99 (roughly) and r.Int() reads one single number from this r. As r is _pseudo_ random and has a constant state (seeded to 99) you always get the same number. V. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.