MCPcopy Create free account
hub / github.com/labstack/gommon / New

Function New

random/random.go:32–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30)
31
32func New() *Random {
33 // https://tip.golang.org/doc/go1.19#:~:text=Read%20no%20longer%20buffers%20random%20data%20obtained%20from%20the%20operating%20system%20between%20calls
34 // sync.Pool must not be copied after first use; construct it directly
35 // on the struct to avoid copying from a local var.
36 return &Random{
37 readerPool: sync.Pool{
38 New: func() interface{} {
39 return bufio.NewReader(rand.Reader)
40 },
41 },
42 }
43}
44
45func (r *Random) String(length uint8, charsets ...string) string {
46 charset := strings.Join(charsets, "")

Callers 2

random.goFile · 0.70
TestFunction · 0.70

Calls

no outgoing calls

Tested by 1

TestFunction · 0.56