Birdman
Birdman
CC#
Created by Birdman on 2/28/2023 in #help
Strange result calculating probability of hit
I'm getting a strange result when running this function
int DamageHitBellCurveCalc() {
var randomValue = Random.value;
var finalValue = 0;
if (randomValue > 0.8623f) {
finalValue = 0;
} else if (randomValue > 0.7424f) {
finalValue = 1;
} else if (randomValue > 0.6379f) {
finalValue = 2;
} else if (randomValue > 0.5469f) {
finalValue = 3;
} else if (randomValue > 0.4676f) {
finalValue = 4;
} else if (randomValue > 0.3986f) {
finalValue = 5;
} else if (randomValue > 0.3384f) {
finalValue = 6;
} else if (randomValue > 0.2860f) {
finalValue = 7;
} else if (randomValue > 0.2404f) {
finalValue = 8;
} else if (randomValue > 0.2006f) {
finalValue = 9;
} else if (randomValue > 0.1660f) {
finalValue = 10;
} else if (randomValue > 0.1358f) {
finalValue = 11;
} else if (randomValue > 0.0867f) {
finalValue = 12;
} else if (randomValue > 0.0667f) {
finalValue = 13;
} else if (randomValue > 0.0493f) {
finalValue = 14;
} else if (randomValue > 0.0342f) {
finalValue = 15;
} else if (randomValue > 0.0210f) {
finalValue = 16;
} else if (randomValue > 0.0096f) {
finalValue = 17;
} else if (randomValue > 0.0045f) {
finalValue = 18;
} else if (randomValue > 0.0023f) {
finalValue = 19;
} else if (randomValue > 0.0012f) {
finalValue = 20;
}
return finalValue;
}
int DamageHitBellCurveCalc() {
var randomValue = Random.value;
var finalValue = 0;
if (randomValue > 0.8623f) {
finalValue = 0;
} else if (randomValue > 0.7424f) {
finalValue = 1;
} else if (randomValue > 0.6379f) {
finalValue = 2;
} else if (randomValue > 0.5469f) {
finalValue = 3;
} else if (randomValue > 0.4676f) {
finalValue = 4;
} else if (randomValue > 0.3986f) {
finalValue = 5;
} else if (randomValue > 0.3384f) {
finalValue = 6;
} else if (randomValue > 0.2860f) {
finalValue = 7;
} else if (randomValue > 0.2404f) {
finalValue = 8;
} else if (randomValue > 0.2006f) {
finalValue = 9;
} else if (randomValue > 0.1660f) {
finalValue = 10;
} else if (randomValue > 0.1358f) {
finalValue = 11;
} else if (randomValue > 0.0867f) {
finalValue = 12;
} else if (randomValue > 0.0667f) {
finalValue = 13;
} else if (randomValue > 0.0493f) {
finalValue = 14;
} else if (randomValue > 0.0342f) {
finalValue = 15;
} else if (randomValue > 0.0210f) {
finalValue = 16;
} else if (randomValue > 0.0096f) {
finalValue = 17;
} else if (randomValue > 0.0045f) {
finalValue = 18;
} else if (randomValue > 0.0023f) {
finalValue = 19;
} else if (randomValue > 0.0012f) {
finalValue = 20;
}
return finalValue;
}
40 replies
CC#
Created by Birdman on 12/7/2022 in #help
❔ Best way to create a unique key made out of x y integer coordonates for a dictionary
Hello, i want to create a unique key to access values in a Dictionary, this key has to be unique and able to be created using just simple x y integer type coordonates. Any help is appreciated. Thank you
62 replies