vendredi 27 février 2015

How can I randomly choose between multiple values, in an Array or not, each with it's own probability? in Java

I'm building a very simple text based Russian Roulette "game", and as I was making a 7 slot bulletChamber array, I kinda realized I'm only storing two values, which are either "there's a bullet" or "there's not a bullet".


and I'm just wondering if there's a way where I can randomly choose between two variables where each one has it's own probability ex 5/7 for no bullet and 2/7 for bullet?





Aucun commentaire:

Enregistrer un commentaire