Skip to content

Commit 3961b71

Browse files
committed
Use real arc4random_uniform() instead of just random() % max
1 parent 2882816 commit 3961b71

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

validation-test/stdlib/Set.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ func helperDeleteThree(k1: TestKeyTy, _ k2: TestKeyTy, _ k3: TestKeyTy) {
9393
}
9494

9595
func uniformRandom(max: Int) -> Int {
96-
// FIXME: this is not uniform.
97-
return random() % max
96+
return Int(arc4random_uniform(UInt32(max)))
9897
}
9998

10099
func pickRandom<T>(a: [T]) -> T {

0 commit comments

Comments
 (0)