Skip to content

Instantly share code, notes, and snippets.

@mikefowler
Forked from anonymous/gist:4315470
Created December 17, 2012 03:00
Show Gist options
  • Save mikefowler/4315512 to your computer and use it in GitHub Desktop.
Save mikefowler/4315512 to your computer and use it in GitHub Desktop.
getRandomColor: ->
number = Math.floor(Math.random() * (3 - 1 + 1)) + 1
switch number
when 1 then "#983a30"
when 2 then "#187598"
# why not
getRandomColor: -> ["#983a30", "#187598"][Math.ceil(Math.random() * 3)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment