I am looking for a simple/easy way to get a script to pick one from a selection of different array's then pick values within them. i need each one to have its own probability.
Currently i have it setup like
$item = array
(
array("item1"),
array("item2"),
array("item3,item4,item5"),
array("item6,item7"),
array("item8,item9,item10"),
);
function getrandomelement($Void) {
$pos=rand(0,sizeof($Void)-1);
$res=$Void[$pos];
if (is_array($res)) return getrandomelement($res);
else return $res;
}
echo getrandomelement($Void);
?>
..
while this is working for a random pick..it does not have the "rarity" i need, so i need a way for it to pick from the following.
$Commonitem = Array(
(
array("item1"),
array("item2"),
);
$rareitem = Array(
(
array("item3","item4","item5"),
array("item6"),
);
$rareitem2 = Array(
(
array("item7","item8","item9"),
array("item10"),
);
so it need to roll the array to pick, then the "item" based on a set bias.
Aucun commentaire:
Enregistrer un commentaire