.randomElement

#randomelement

Overview

Chooses from an array of data.

Subjects

Sample Codes

let numbers = [100, 80, 85]

if let winner = numbers.randomElement() {
    print("The winning number is \(winner).")
}

Sources

Videos

Articles / Documents

Last updated