String returns a random string made of numbers, upper-, and lower-case letters
(length int)
| 35 | |
| 36 | // String returns a random string made of numbers, upper-, and lower-case letters |
| 37 | func String(length int) string { |
| 38 | ar := make([]byte, length) |
| 39 | randInts := randCryptoInts(length) |
| 40 | alphabetLength := int32(len(alphabet)) |
| 41 | |
| 42 | for i := range ar { |
| 43 | x := randInts[i] |
| 44 | if x < 0 { |
| 45 | x = -x |
| 46 | } |
| 47 | randIndex := x % alphabetLength |
| 48 | ar[i] = alphabet[randIndex] |
| 49 | } |
| 50 | |
| 51 | return string(ar) |
| 52 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…