pkg/common/test/rand.go   A
last analyzed

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 11
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A test.RandStringRunes 0 9 2
1
package test
2
3
import (
4
	"math/rand"
5
	"time"
6
)
7
8
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
9
10
func RandStringRunes(n int) string {
11
	rand.Seed(time.Now().UnixNano())
12
13
	b := make([]rune, n)
14
	for i := range b {
15
		b[i] = letterRunes[rand.Intn(len(letterRunes))] //nolint
16
	}
17
18
	return string(b)
19
}
20