Rand generates a random bit array of the specified length.
(rng *rand.Rand, bitLen uint)
| 549 | |
| 550 | // Rand generates a random bit array of the specified length. |
| 551 | func 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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…