mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-09-22 19:09:05 +02:00
co-authored by
ChatGPT
parent
91d37126fa
commit
96fac69304
@@ -52,7 +52,7 @@ func GenerateRandomString(length int, charset string) (string, error) {
|
||||
|
||||
// Discard bytes that are outside of the range
|
||||
// This allows making sure that we maintain uniform distribution
|
||||
idx := int(randomBytes[j%length] & letterIdxMask)
|
||||
idx := int(randomBytes[j%bufferSize] & letterIdxMask)
|
||||
if idx < len(charset) {
|
||||
result.WriteByte(charset[idx])
|
||||
i++
|
||||
|
||||
Reference in New Issue
Block a user