mardi 13 décembre 2016

Randomly Output A Number based on the percentage given

I am currently trying to make a Pokemon Game in Python, however, when you try to catch Pokemon, those legendary Pokemons wont share the same appear rate as normal Pokemons. Therefore I want to import the percentage randomness into the Python, in case you dont understand, this is what I suppose to happen:

Magikrap 10%

Greninja 1%

Lapras 1%

Psyduck 15%

and I want the Python to generate 10 Magikraps if I need it to random generate 100 Pokemons

I am wondering should I import random from Python or what should I do? Thank you




Aucun commentaire:

Enregistrer un commentaire