From 54a13c049fbc87e8e1420fb9bbe0d6dd06ab8d13 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 23 May 2016 14:08:32 +0100 Subject: [PATCH] Return byte slice not string --- util/rand/rand.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/rand/rand.go b/util/rand/rand.go index effa217e..cb881917 100644 --- a/util/rand/rand.go +++ b/util/rand/rand.go @@ -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 } }