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

Code Example 1

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 akashmittal.com