mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-24 04:17:48 +00:00
The stdlib's randomElement() method extends Collection, since it operates by selecting a random index. This adds randomElement() as a Sequence method, specializing the reservoir sampling algorithm from randomSample(count:) for a count of 1.