package astikit import ( "math/rand" "strings" "time" ) const ( randLetterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" randLetterIdxBits = 6 // 6 bits to represent a letter index randLetterIdxMask = 1<= 0; { if remain == 0 { cache, remain = randSrc.Int63(), randLetterIdxMax } if idx := int(cache & randLetterIdxMask); idx < len(randLetterBytes) { sb.WriteByte(randLetterBytes[idx]) i-- } cache >>= randLetterIdxBits remain-- } return sb.String() }