RandomString returns random string read from crypto/rand.
(n int)
| 40 | |
| 41 | // RandomString returns random string read from crypto/rand. |
| 42 | func RandomString(n int) string { |
| 43 | p := make([]byte, n/2+1) |
| 44 | crand.Read(p) |
| 45 | return hex.EncodeToString(p)[:n] |
| 46 | } |
| 47 | |
| 48 | // RandomPort() returns a random port to be used with net.Listen(). It's an |
| 49 | // helper function to register to kontrol before binding to a port. Note that |