We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c33d028 commit d1f7035Copy full SHA for d1f7035
1 file changed
Example/Sources/Data Generation/Lorem.swift
@@ -223,6 +223,10 @@ public extension Array {
223
Shuffle the array in-place using the Fisher-Yates algorithm.
224
*/
225
mutating func shuffle() {
226
+ if count == 0 {
227
+ return
228
+ }
229
+
230
for i in 0..<(count - 1) {
231
let j = Int(arc4random_uniform(UInt32(count - i))) + i
232
if j != i {
0 commit comments