Skip to content

Commit c8f7617

Browse files
committed
Update README.markdown
1 parent 8105b70 commit c8f7617

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Selection Sampling/README.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Let's say you have a deck of 52 playing cards and you need to draw 10 cards at r
77
Here's a very fast version:
88

99
```swift
10+
public func random(min: Int, max: Int) -> Int {
11+
assert(min < max)
12+
return min + Int(arc4random_uniform(UInt32(max - min + 1)))
13+
}
14+
15+
1016
func select<T>(from a: [T], count k: Int) -> [T] {
1117
var a = a
1218
for i in 0..<k {

0 commit comments

Comments
 (0)