Skip to content

Commit 68a2a2c

Browse files
committed
remember to use the generator
1 parent 7af435c commit 68a2a2c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

stdlib/public/core/Collection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ extension Collection {
929929
using generator: inout T
930930
) -> Element? {
931931
guard !isEmpty else { return nil }
932-
let random = Int.random(in: 0 ..< count)
932+
let random = Int.random(in: 0 ..< count, using: &generator)
933933
let idx = index(
934934
startIndex,
935935
offsetBy: random

stdlib/public/core/CollectionAlgorithms.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ extension MutableCollection where Self : RandomAccessCollection {
449449
var amount = count
450450
var currentIndex = startIndex
451451
while amount > 1 {
452-
let random = Int.random(in: 0 ..< amount)
452+
let random = Int.random(in: 0 ..< amount, using: &generator)
453453
amount -= 1
454454
swapAt(
455455
currentIndex,

0 commit comments

Comments
 (0)