I receive Lists of uncertain size, usually between 4~10 counts long:
{Apples, Orange, Pear, ?, ? ...}
How can I have Apples have the highest % chance spawning, then orange, then pear?
The effect is essentially the same as picking a random item from a List that looks like this:
{Apples, Apples, Apples, Apples, Orange, Orange, Pear}
If the List size were fixed, I would've done
- Generate a float between 0.0~1.0;
- If <0.4, generate Apples. else if <0.2
Aucun commentaire:
Enregistrer un commentaire