test.RandStringRunes   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
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