Rand generates a random bit array of the specified length.
(rng *rand.Rand, bitLen uint)
| 511 | |
| 512 | // Rand generates a random bit array of the specified length. |
| 513 | func Rand(rng *rand.Rand, bitLen uint) BitArray { |
| 514 | d := MakeZeroBitArray(bitLen) |
| 515 | for i := range d.words { |
| 516 | d.words[i] = rng.Uint64() |
| 517 | } |
| 518 | if len(d.words) > 0 { |
| 519 | d.words[len(d.words)-1] <<= (numBitsPerWord - d.lastBitsUsed) |
| 520 | } |
| 521 | return d |
| 522 | } |
| 523 | |
| 524 | // Next returns the next possible bit array in lexicographic order. |
| 525 | // The backing array of words is shared if possible. |
nothing calls this directly
no test coverage detected
searching dependent graphs…