I need to generate numbers up to 4 decimal places between 0 and 1 (inclusive), with the rarity for each value distributed like a bell curve centered at 0.5 (0.5 is the most common, and it gets progressively more rare the closer you get to 0 or 1). I have tried a lot of methods to produce this, but they usually result with 0 and 1 being more common than their previous values (0.0001 and 0.9999) due to floating point precision/rounding errors. The only clean solution I have come up with is to assign a weight to each value, and then pick a value based on its weight. This seems like overkill though so I was wondering if anyone has a cleaner solution.
#Generate Numbers Without Floating Imprecision
1 messages · Page 1 of 1 (latest)
pick a random integer instead of using a continuous range
so. random.NextInteger(1,10000) or whatever
Do you know how I would go about making the rarity of each number distributed like a bell curve centered at 5000?
box muller transform probably
i dont remember if luau has any built-in normal distribution stuff
This is a method i tried before that resulted in rounding errors. There are no built in functions so it was custom. Not sure if I can do it with integers
umm how precise do you need it
what exactly are you making
I need it 100% precise
Clean rarity distribution and never values less than 0, greater than 1, or more than 4 decimal places (like 0.50140000000000001 like floats like to do)