Random NSColor or UIColor in Swift 2

Yup, not much else to add. Here it is:

let randomColor = NSColor(red: CGFloat(drand48()), green: CGFloat(drand48()), blue: CGFloat(drand48()), alpha: 1.0)

For iOS developers out there just change NSColor to UIColor. 

 

Marc

PS: Drand48 will create a random number between 0 and 1.