Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
fix random int range
Browse files Browse the repository at this point in the history
  • Loading branch information
bit101 committed Jan 1, 2022
1 parent 6359740 commit d187689
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions random/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ func FloatRange(min float64, max float64) float64 {

// IntRange returns a random int from min to max.
func IntRange(min int, max int) int {
randRange := float64(max - min)
return min + int(math.Round(rand.Float64()*randRange))
return int(FloatRange(float64(min), float64(max)))
}

// Boolean returns a random boolean.
Expand Down

0 comments on commit d187689

Please sign in to comment.