[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2020-02-11 Thread anderson . queiroz
If you use the same seed the source will output the same pseudo-random output. Which is quite useful when you need to be able to replay/predict the random behaviour On Tuesday, 26 March 2019 19:48:27 UTC+1, Liam wrote: > > Could anyone clarify the difference between these two? > > r :=

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2020-02-10 Thread prratnakar
Seed initialise default resource once for random method and using NewSource create different resources for random method On Wednesday, 27 March 2019 21:46:18 UTC+5:30, dja...@gmail.com wrote: > > Hi, > I think OP question actually is what is difference between: > r :=

Re: [go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2019-03-27 Thread Ian Lance Taylor
On Wed, Mar 27, 2019 at 9:16 AM wrote: > > Hi, > I think OP question actually is what is difference between: > r := rand.New(rand.NewSource(VALUE)) > > and > r := rand.New(rand.NewSource(ANYTHING)) > > r.Seed(VALUE) > > https://play.golang.org/p/afOfMjcNs1q I don't think there is any meaningful

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2019-03-27 Thread djadala
Hi, I think OP question actually is what is difference between: r := rand.New(rand.NewSource(VALUE)) and r := rand.New(rand.NewSource(ANYTHING)) r.Seed(VALUE) https://play.golang.org/p/afOfMjcNs1q -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Re: rand.Rand.Seed() vs rand.NewSource()

2019-03-27 Thread jake6502
Following up on Ian's post. It is generally a good idea to go to the playground and make a minimal working "program" to demonstrate your question before posting. In doing so you would have discovered that the zero value of a rand.Rand can not be used, and will panic.