upgraded to math/rand/v2
This commit is contained in:
@@ -3,7 +3,7 @@ package security
|
|||||||
import (
|
import (
|
||||||
cryptoRand "crypto/rand"
|
cryptoRand "crypto/rand"
|
||||||
"math/big"
|
"math/big"
|
||||||
mathRand "math/rand" // @todo replace with rand/v2?
|
mathRand "math/rand/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultRandomAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
const defaultRandomAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
|
||||||
@@ -52,7 +52,7 @@ func PseudorandomStringWithAlphabet(length int, alphabet string) string {
|
|||||||
max := len(alphabet)
|
max := len(alphabet)
|
||||||
|
|
||||||
for i := range b {
|
for i := range b {
|
||||||
b[i] = alphabet[mathRand.Intn(max)]
|
b[i] = alphabet[mathRand.IntN(max)]
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(b)
|
return string(b)
|
||||||
|
|||||||
Reference in New Issue
Block a user