hello Golang devs I am learning golang and I am using the Math/Rand package. I am curious why I am getting the same result on:
// always returning 81
rand.Intn(100)
hello Golang devs I am learning golang and I am using the Math/Rand package. I am curious why I am getting the same result on:
// always returning 81
rand.Intn(100)
The documentation for math/rand
says:
Top-level functions, such as Float64 and Int, use a default shared Source that produces a deterministic [fixed] sequence of values each time a program is run. Use the Seed function to initialize the default Source if different behavior is required for each run.