golang random integer code example
Example 1: random number golang
// Uniform Random int (min <= x <= max)
x = rand.Intn(max - min) + min
// Uniform random float (0 <= x <= 1)
x = rand.Float64()
// Uniform random float (min <= x <= max)
x = (rand.Float64() * (max - min)) + min
Example 2: golang random number in range
rand.Intn(max - min) + min