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? 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. 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 Link to comment https://forums.phpfreaks.com/topic/53725-card-deck/#findComment-265498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.