MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / RandomBuf

Function RandomBuf

IceFireDB-SQLite/pkg/mysql/mysql/util.go:108–123  ·  view source on GitHub ↗
(size int)

Source from the content-addressed store, hash-verified

106}
107
108func RandomBuf(size int) ([]byte, error) {
109 buf := make([]byte, size)
110
111 if _, err := io.ReadFull(rand.Reader, buf); err != nil {
112 return nil, errors.Trace(err)
113 }
114
115 // avoid to generate '\0'
116 for i, b := range buf {
117 if b == 0 {
118 buf[i] = '0'
119 }
120 }
121
122 return buf, nil
123}
124
125// FixedLengthInt: little endian
126func FixedLengthInt(buf []byte) uint64 {

Callers 4

NewConnFunction · 0.50
NewCustomizedConnFunction · 0.50
NewClientConnFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected