MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / Rand

Function Rand

pkg/util/bitarray/bitarray.go:551–560  ·  view source on GitHub ↗

Rand generates a random bit array of the specified length.

(rng *rand.Rand, bitLen uint)

Source from the content-addressed store, hash-verified

549
550// Rand generates a random bit array of the specified length.
551func Rand(rng *rand.Rand, bitLen uint) BitArray {
552 d := MakeZeroBitArray(bitLen)
553 for i := range d.words {
554 d.words[i] = rng.Uint64()
555 }
556 if len(d.words) > 0 {
557 d.words[len(d.words)-1] <<= (numBitsPerWord - d.lastBitsUsed)
558 }
559 return d
560}
561
562// Next returns the next possible bit array in lexicographic order.
563// The backing array of words is shared if possible.

Callers

nothing calls this directly

Calls 2

MakeZeroBitArrayFunction · 0.85
Uint64Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…