jeudi 18 février 2021

How to set up random % chance based on value of variable with javascript

Lets say that i have a variable which has a value of 5, the higher the value of the variable the higher the chance of succes.

So how could i do something like this?:

function mission1() {
if (user_power < 5) {
//30% change of succes
} else if (user_power == 5) {
//50% change of succes
} else if (user_power > 5) {
//80% change of succes
}



Aucun commentaire:

Enregistrer un commentaire