Return to Snippet

Revision: 80650
at March 23, 2020 17:58 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2016/10/21/swift-get-random-boolean/

Updated Code
https://www.chrisjmendez.com/2016/10/21/swift-get-random-boolean/

Updated Description
https://www.chrisjmendez.com/2016/10/21/swift-get-random-boolean/

Revision: 70955
at October 21, 2016 12:27 by chrisaiv


Initial Code
func randomBool() -> Bool {
        return arc4random_uniform(2) == 0 ? true : false
    }

Initial URL

                                

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

Initial Title
Swift: Get Random Boolean

Initial Tags
c

Initial Language
Objective C