swift

Swift 4.2 - What's New

In this post, I would like to share what’s new in Swift 4.2. All the code displayed in this post is available at my GitHub repo my-learnings/Swift4.2. Random Number Generation Swift 4.2 added random number generator API to standard library. You can use it on Int, Double, Float, CGFloat and Bool. It also provides a convenient API randomElement which returns a random element from a sequence It also provides the APIs shuffle and shuffled to shuffle a sequence 1 2 let randomInt = Int.