fixed an endless loop when length of chars is a divisor of 256
This commit is contained in:
parent
bc4af7603a
commit
1b691aeab2
2 changed files with 26 additions and 8 deletions
|
|
@ -56,7 +56,7 @@ func NewLenChars(length int, chars []byte) string {
|
|||
panic("error reading from random source: " + err.Error())
|
||||
}
|
||||
for _, c := range r {
|
||||
if c >= maxrb {
|
||||
if c > maxrb {
|
||||
// Skip this number to avoid modulo bias.
|
||||
continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue