How to convert arc4random() to Int , i tried as below but it throws error
var items = Color[]()
var i = Int(arc4random()) % items.count
and the colour is enum type
enum Color: Int {
case Red, Green, Blue
}
The error is EXC_BAD_INSTRUCTION. Checking the debugger shows items is size=1 and [0] = (AppName.Color) (0x10).