[Solved] How to get a sample of random numbers in golang? [closed]
What you did is clean and fast enough. What you could improve on it is to pre-allocate the slice and fill it using a for.. range loop like this: s := make([]int, 5) for i := range s { s[i] = rand.Intn(100) } The math/rand package also has a rand.Read() function which fills a slice … Read more