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 Swift4_2-WhatsNew.playground. 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 let randomInt = Int.