VBunny_ohplease Posted January 5, 2010 Share Posted January 5, 2010 I work on an online game (for fun) which requires me to randomize names of "card images" (with numbers). However, some card decks have 20 images, and some have 15. I have the seperate decks randomizing names on their own: $character = array ( "alice", "jasmine", "peach" ); $scenary = array ( "palace", "forest", "dungeon" ); I am wondering how to randomize both of the arrays, so everyone has an equal chance of getting either "character" or "scenary". I've tried things like: $blech=$character[array_rand($character,1)] && scenary[array_rand($scenary,1)]; And I can't find any tutorials on this sort of thing, or what it's called. Link to comment https://forums.phpfreaks.com/topic/187318-randomize-multiple-arrays/ Share on other sites More sharing options...
salathe Posted January 5, 2010 Share Posted January 5, 2010 If deck A had two cards and B ten cards, would the chances of getting a card from A or B still be equal? Link to comment https://forums.phpfreaks.com/topic/187318-randomize-multiple-arrays/#findComment-989165 Share on other sites More sharing options...
VBunny_ohplease Posted January 5, 2010 Author Share Posted January 5, 2010 I guess the real problem is, I want both card sets to be in the system but I cannot figure out how to have both sets be randomized within the same array. Link to comment https://forums.phpfreaks.com/topic/187318-randomize-multiple-arrays/#findComment-989168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.