Skip to content

Instantly share code, notes, and snippets.

@toshi0383
Created August 25, 2015 06:57
Show Gist options
  • Select an option

  • Save toshi0383/bbd6e78e1394fe861597 to your computer and use it in GitHub Desktop.

Select an option

Save toshi0383/bbd6e78e1394fe861597 to your computer and use it in GitHub Desktop.
import Darwin
enum Member: Int {
case Nakagawa, Otani, Mattsu, Toshi, Minami
case Unknown
static let count:Int = 5
static func getSomeone() -> Member {
let r = Int(arc4random_uniform(10000))
let i = r % Member.count
return Member(rawValue: i) ?? Member.Unknown
}
}
print(Member.getSomeone())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment