Browse Source

Name change.

master
Jeff Baskin 4 years ago
parent
commit
ba09a48aea
  1. 4
      genid.go
  2. 2
      genid_test.go

4
genid.go

@ -9,7 +9,7 @@ import (
const idLength = 64
var numberLetterRunes = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
var runeList = []rune("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func init() {
rand.Seed(time.Now().UnixNano())
@ -18,7 +18,7 @@ func init() {
func newID() string {
id := make([]rune, idLength)
for i := range id {
id[i] = numberLetterRunes[rand.Intn(len(numberLetterRunes))]
id[i] = runeList[rand.Intn(len(runeList))]
}
return string(id)
}

2
genid_test.go

@ -25,7 +25,7 @@ func TestForRandomID(t *testing.T) {
}
}
func BenchmarkNesID(b *testing.B) {
func BenchmarkNewID(b *testing.B) {
for n := 0; n < b.N; n++ {
newID()
}

Loading…
Cancel
Save