Swap three colors every refresh randomly

Viewed 130

I have three classes with three different colors. How can I swap the background-colors randomly every page visit?

Fiddle

.projects{background:#99c6c3;}  
.other-things{background:#d3d3d3;}
.about {background:#eedd8d;}    

I tried to use this js :

var bgcolorlist=new Array("#99c6c3", "#d3d3d3", "#eedd8d")
$(".projects").css("background-color",bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)]);

But I don't want two colors to be the same.

1 Answers
Related