[BitArray] Add docs.

This commit is contained in:
Karoy Lorentey committed 2022-08-25 23:50:35 -07:00
1 parent fcac09d86a
commit 5bc22eaf9b
9 files changed
+348 -12

No files matched your search

@@ -10,11 +10,19 @@
//===----------------------------------------------------------------------===//
extension BitArray {
/// Create and return a new bit array consisting of `count` random bits.
///
/// - Parameter count: The number of random bits to generate.
public static func random(count: Int) -> BitArray {
var rng = SystemRandomNumberGenerator()
return random(count: count, using: &rng)
}
/// Create and return a new bit array consisting of `count` random bits,
/// using the given random number generator.
///
/// - Parameter count: The number of random bits to generate.
/// - Parameter rng: The random number generator to use.
public static func random<R: RandomNumberGenerator>(
count: Int,
using rng: inout R