MemphiS Posted May 31, 2007 Share Posted May 31, 2007 Curent code: for ($f=0; $f<52; $f++){ shuffle($fdeck); $countCRD = count($fdeck); $yourcaRD = rand()%$countCRD; if ($fdeck[$yourcaRD]==""){ $f--; }else{ if ( $mYcrd[] = $fdeck[$yourcaRD]; $fdeck[$yourcaRD]==""; } } Does someone know how to work out how to stop it from producing two of the same cards out? Quote Link to comment https://forums.phpfreaks.com/topic/53725-card-deck/ Share on other sites More sharing options...
chigley Posted May 31, 2007 Share Posted May 31, 2007 Can you explain what it's doing? I'd make an array with ones you've already used and use in_array() to check if you've already done one or not each time. Quote Link to comment https://forums.phpfreaks.com/topic/53725-card-deck/#findComment-265495 Share on other sites More sharing options...
MemphiS Posted May 31, 2007 Author Share Posted May 31, 2007 Thanks that helped me work out how to do what i wanted Quote Link to comment https://forums.phpfreaks.com/topic/53725-card-deck/#findComment-265498 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.