Created
January 17, 2015 12:11
-
-
Save zhjuncai/0def15ec065b1f0b68bf to your computer and use it in GitHub Desktop.
Get Random color - swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| Get Random Color by generating three random float to represent RGB | |
| **/ | |
| func randomColor() -> UIColor{ | |
| var randomRed:CGFloat = CGFloat(drand48()) | |
| var randomGreen:CGFloat = CGFloat(drand48()) | |
| var randomBlue:CGFloat = CGFloat(drand48()) | |
| return UIColor(red: randomRed, green: randomGreen, blue: randomBlue, alpha: 1.0) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment