newRandomString creates a new random string.
()
| 43 | |
| 44 | // newRandomString creates a new random string. |
| 45 | func newRandomString() string { |
| 46 | const blockSize = 1024 * 1024 |
| 47 | r, err := rand.Int(rand.Reader, big.NewInt(4)) |
| 48 | if err != nil { |
| 49 | panic(err) |
| 50 | } |
| 51 | length := r.Int64() * blockSize |
| 52 | |
| 53 | r, err = rand.Int(rand.Reader, big.NewInt(blockSize)) |
| 54 | if err != nil { |
| 55 | panic(err) |
| 56 | } |
| 57 | length += r.Int64() |
| 58 | |
| 59 | return newRandomStringN(int(length)) |
| 60 | } |
| 61 | |
| 62 | // newRandomStringN creates a new random string of length n. |
| 63 | func newRandomStringN(n int) string { |
no test coverage detected