random boolean swift5 code example
Example: generate random bool swift
let flippedHeads = Bool.random()
if flippedHeads {
print("Heads, you win!")
} else {
print("Maybe another try?")
}
let flippedHeads = Bool.random()
if flippedHeads {
print("Heads, you win!")
} else {
print("Maybe another try?")
}