b1011 Posted July 30, 2007 Share Posted July 30, 2007 I have the following script: $color=rand(0,9); switch ($color){ case 0: $cc="#CCFFCC"; break; case 1: $cc="#CC6600"; break; case 2: $cc="#0000CC"; break; case 3: $cc="#CC00FF"; break; case 4: $cc="#00CC66"; break; case 5: $cc="#CCCC00"; break; case 6: $cc="#616D7E"; break; case 7: $cc="#25383C"; break; case 8: $cc="#3BB9FF"; break; case 9: $cc="#9E7BFF"; break; } witch goes to 34 outcomes. How can i make it rerandomize if it was already made? (this was in a while statement) Can i set up an array with the current colors? But how can i check if data exits in an array. Quote Link to comment https://forums.phpfreaks.com/topic/62558-re-randomize-if-its-taken/ Share on other sites More sharing options...
trq Posted July 30, 2007 Share Posted July 30, 2007 in_array. Quote Link to comment https://forums.phpfreaks.com/topic/62558-re-randomize-if-its-taken/#findComment-311422 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.