And no, don't do what you said in that last post, just regen and test until you get the BEHAVIOUR you want in an actual test. Looking at the numbers directly is cheating.
The problem is that I would like to run fewer tests. If the "top unit" is a kiter, then a slow unit isn't ever going to beat it. Not even with max HP and max Armor, so I need to weight the RNG values so that the two best results are given towards speed/range. I'm not
looking at the values I'm saying "I need a unit weighted towards speed" and using RNG calls that end up with speed.
All I'm doing is passing the Math.random() through the sort, not the Math.floor(Math.random()*Max)+Min because the range is always different. I still have four random values, but rather than using them in the order I get them, I'm using them in the order I would like to use them. It'd be like D&D trying to build a Ranger and putting your highest dice-roll into Dex because
you need dexterity vs. rolling 3d6 for strength (16), 3d6 for con (13), 3d6 for dex (8 )...and going, "shit, this would make a crappy ranger" and starting over.
So I'm trying to short-cut the "generate until it wins" and instead "generate a probable winner."
Fine, be a pedant then. By arbitrarily high I mean the max value is thousands of times higher than will plausibly occur even if you generates thousands of units. It just means a distribution with a very long tail.
This is also difficult. RNGs return an even distribution of floating point numbers between 0 and 1. A "distribution with a very long tail" requires that I square, cube, or even worse the RNG to get values closer and closer to 0, then multiply by some huge number. Which I'm already doing for NumShots. The problem is that "very long tale" creates a sequence like this:
1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,4,4,4,4,5,5,6,7,9,11,14,18,24,33,44,59,75,100.
The "long tail" generates increasingly large values as your base multiplier gets larger (so that your minimum value still returns 1).
A a "cube a RNG" and multiply by N, 10% of the time you'll get a value of 0.72 * N or greater 10% of the time. RNG^5 returns a value 0.6*N or greater 10% of the time, but you'll also get 0.00001*N 10% of the time, so N would need to be 1000 just to account for it, making 0.6N equal to 600. 10% of your units have a "stat" of 1, while 10% of them have a stat of
600 or more.