MCPcopy Index your code
hub / github.com/koding/kite / RandomString

Function RandomString

utils/utils.go:42–46  ·  view source on GitHub ↗

RandomString returns random string read from crypto/rand.

(n int)

Source from the content-addressed store, hash-verified

40
41// RandomString returns random string read from crypto/rand.
42func 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

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected