Return byte slice not string
This commit is contained in:
parent
9085865e35
commit
54a13c049f
1 changed files with 3 additions and 3 deletions
|
@ -21,10 +21,10 @@ import (
|
|||
var chars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
|
||||
// New produces a random string of length n
|
||||
func New(l int) string {
|
||||
func New(l int) []byte {
|
||||
|
||||
if l == 0 {
|
||||
return ""
|
||||
return nil
|
||||
}
|
||||
|
||||
i := 0
|
||||
|
@ -45,7 +45,7 @@ func New(l int) string {
|
|||
b[i] = chars[c%t]
|
||||
i++
|
||||
if i == l {
|
||||
return string(b)
|
||||
return b
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue