What is the modulus operator (%) in swift 3?
You can simply follow the diagnostic message:
let randomIndex = Int(drand48().truncatingRemainder(dividingBy: Double(alphabetColors.count)))
Or using arc4random_uniform(_:)
would be a better alternative.
let randomIndex = Int(arc4random_uniform(UInt32(alphabetColors.count)))
This seems to be available for me, currently on Swift 3.1, so possible it was added back.
My guess is that it's somewhere in Foundation and needs an explicit import Foundation
Update
This is for Int types only. It seems that for doubles, truncating remainder is required.