crazysaint Posted July 16, 2007 Share Posted July 16, 2007 i would like to come up with two codes in ASP that will a) simulate the throeing of a dice: when run it should display the face value of the dice(between 1 and 6) b)then also i would like to come up with another code that shows that all faces have equal liklihood of being shown.(should throw it for about 6000 times). i know it has something to do with using a counter for eah face and increment as it wins. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted July 16, 2007 Share Posted July 16, 2007 hmmm maybe you should try an asp forum. in php this may help (assumes you really want to do the 6000 throws)... $throw = rand(1,6); echo $throw; $throwarr = array(); for($i = 0; $i < 6000; $i++) { $throwarr[] = rand(1,6); } $numbers = array_unique($throwarr); $tally = array(); foreach ($numbers as $val) { $tally[$val] = count(array_keys($throwarr,$val)); } print_r($tally); Quote Link to comment 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.