#Generate Numbers Without Floating Imprecision

1 messages · Page 1 of 1 (latest)

lusty breach
#

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.

ornate shuttle
#

so. random.NextInteger(1,10000) or whatever

lusty breach
ornate shuttle
#

i dont remember if luau has any built-in normal distribution stuff

lusty breach
ornate shuttle
#

what exactly are you making

lusty breach
#

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)