Check out example codes for "random number swift". It will help you in understanding the concepts better.

Code Example 1

let randInt = Int.random(in: 0...100)

// The range can be a closed (a...b) or half open (a..<b) range.

Code Example 2

let randomInt = Int.random(in: 0..<6)
let randomDouble = Double.random(in: 2.71828...3.14159)
let randomBool = Bool.random()

Learn ReactJs, React Native from