Giraffe Giraffe - 1 month ago 3x
Swift Question

How to randomly select an enum in Swift

enum randomName: UInt32 {
case name1
case name2
case name3
case name4
case name5
case name6
case name7
case name8

I want to make a function to randomly pick a name from the enum. How do I do that?

randomName(rawValue: arc4random_uniform(randomName.name8.rawValue + 1))