Skip to content

Commit

Permalink
RandomAlphaString fix for 32-bit (#200)
Browse files Browse the repository at this point in the history
Co-authored-by: Abe Winter <[email protected]>
  • Loading branch information
abe-winter and Abe Winter authored Sep 5, 2023
1 parent a36e2af commit 300b46e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions string.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const alphaLowers string = "abcdefghijklmnopqrstuvwxyz"

var (
alphaUppers = strings.ToUpper(alphaLowers)
maxIntBig = big.NewInt(math.MaxInt64)
maxInt32 = big.NewInt(math.MaxInt32)
fiftyFityChance = big.NewInt(2)
)

Expand All @@ -24,7 +24,7 @@ func RandomAlphaString(size int) string {
}
chars := make([]byte, 0, size)
for i := 0; i < size; i++ {
valBig, err := rand.Int(rand.Reader, maxIntBig)
valBig, err := rand.Int(rand.Reader, maxInt32)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 300b46e

Please sign in to comment.