Proposal
This proposal suggests adding a new function, IntInRange(low, high int) int, to the math/rand package.
The function generates random integers within a specified range [low, high).
Function Implementation
func IntInRange(low, high int) int {
return rand.Intn(high-low) + low
}
Rationale
- It simplifies random integer generation within a specific range, making it easier especially for beginners.
- Provides a clean and concise code for this common task.
Proposal
This proposal suggests adding a new function,
IntInRange(low, high int) int, to themath/randpackage.The function generates random integers within a specified range [low, high).
Function Implementation
Rationale