Swift: Get Random Boolean

/ Published in: Objective C

This function will help you get a random true or false boolean value.

Copy this code and paste it in your HTML
  1. func randomBool() -> Bool {
  2. return arc4random_uniform(2) == 0 ? true : false
  3. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.