Jump to content

Randomize multiple arrays


VBunny_ohplease

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.