Merge pull request #9 from argusdusty/patch-1

Correct for bias towards first character in chars
This commit is contained in:
Dmitry Chestnykh 2015-04-04 00:38:26 +02:00
commit d7c89a5f19

View File

@ -57,7 +57,7 @@ func NewLenChars(length int, chars []byte) string {
if clen > 256 { if clen > 256 {
panic("uniuri: maximum length of charset for NewLenChars is 256") panic("uniuri: maximum length of charset for NewLenChars is 256")
} }
maxrb := 256 - (256 % clen) maxrb := 255 - (256 % clen)
b := make([]byte, length) b := make([]byte, length)
r := make([]byte, length+(length/4)) // storage for random bytes. r := make([]byte, length+(length/4)) // storage for random bytes.
i := 0 i := 0