Check out example codes for "generate random bool swift". It will help you in understanding the concepts better.
Code Example 1
let flippedHeads = Bool.random()
if flippedHeads {
print("Heads, you win!")
} else {
print("Maybe another try?")
}
Learn ReactJs, React Native from akashmittal.com