Current section
Files
Jump to
Current section
Files
src/winner.gleam
import gleam/int
import gleam/iterator
import gleam/list
const drivers = [
"Lando", "Lance", "Lewis", "Max", "Alex", "Franco", "Kevin", "Oscar",
]
pub fn choose_winner() {
let random_index = int.random(list.length(drivers))
let chosen_winner = iterator.from_list(drivers) |> iterator.at(random_index)
case chosen_winner {
Ok(winner) -> winner
Error(Nil) -> "No winner found"
}
}