MCPcopy
hub / github.com/OJ/gobuster / randomString

Function randomString

libgobuster/http_test.go:34–47  ·  view source on GitHub ↗
(length int)

Source from the content-addressed store, hash-verified

32}
33
34func randomString(length int) (string, error) {
35 letter := []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
36 letterLen := len(letter)
37
38 b := make([]byte, length)
39 for i := range b {
40 n, err := rand.Int(rand.Reader, big.NewInt(int64(letterLen)))
41 if err != nil {
42 return "", err
43 }
44 b[i] = letter[n.Int64()]
45 }
46 return string(b), nil
47}
48
49func TestRequest(t *testing.T) {
50 t.Parallel()

Callers 4

TestRequestFunction · 0.85
BenchmarkRequestWitBodyFunction · 0.85
BenchmarkNewHTTPClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected