crypto/rand is another option. I use the math/rand repeatability to be able to regenerate a picture made of random elements, where I modify the seed until I’m happy with the result but later I may need to re-render at different dimensions or with other parameters.
Matt On Thursday, March 15, 2018 at 9:53:48 AM UTC-5, Michael Jones wrote: > > As it turns out, repeatability of "random" experiments is very important, > especially during development. > > On Wed, Mar 14, 2018 at 11:35 PM, Andrea Alessandrini <ndr...@gmail.com > <javascript:>> wrote: > >> >> >> Il giorno mercoledì 14 marzo 2018 18:38:51 UTC+1, Burak Serdar ha scritto: >>> >>> It is explained here: >>> >>> https://golang.org/pkg/math/rand/ >>> >>> >> oh, thanks a lot. >> >> Now I can see that's a quite common doubt :-) >> >> >> https://stackoverflow.com/questions/45753397/why-does-golang-repeats-the-same-random-number >> >> >> >> >>> On Wed, Mar 14, 2018 at 11:26 AM, Andrea Alessandrini <ndr...@gmail.com> >>> wrote: >>> > I wrote this simple code >>> > >>> > package main >>> > import ( >>> > "fmt" >>> > "math/rand" >>> > ) >>> > func main() { >>> > for i := 0; i < 6; i++ { >>> > fmt.Println("My favorite number is", rand.Intn(100)) >>> > fmt.Println("My favorite number is", rand.Int()) >>> > } >>> > } >>> > >>> > >>> > and I run it in my pc or in a web application >>> > (https://tour.golang.org/basics/1 ) >>> > >>> > For each application I got the same result : >>> > always: >>> > >>> >> $ go run 00_random.go >>> >> My favorite number is 81 >>> >> My favorite number is 8674665223082153551 >>> >> My favorite number is 47 >>> >> My favorite number is 4037200794235010051 >>> >> My favorite number is 81 >>> >> My favorite number is 6334824724549167320 >>> >> My favorite number is 25 >>> >> My favorite number is 1443635317331776148 >>> >> My favorite number is 56 >>> >> My favorite number is 2775422040480279449 >>> >> My favorite number is 94 >>> >> My favorite number is 7504504064263669287 >>> > >>> > >>> > >>> > It seams i should reset the memory, but I don't know how... >>> > >>> > Andrea >>> > >>> > -- >>> > 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...@googlegroups.com. >>> > For more options, visit https://groups.google.com/d/optout. >>> >> -- >> 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...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Michael T. Jones > michae...@gmail.com <javascript:> > -- 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.