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)))

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)