I have a method where you can pass in a percentage, and it tells you whether or not you succeeded by random chance. So if you call it with .25, it'll return true 25% of the time. I'm trying to figure out if I can use this function alone to do something like this: There is a 25% chance for x, a 40% chance for y, and a 35% chance for z
The trick is, I want to be able to think about it the way I just described above. In other words:
result = function ({.25, x}, {.4, y}, {.35, z})
Can I implement this function with my existing function alone?
Aucun commentaire:
Enregistrer un commentaire