mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-22 04:10:39 +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.