Hi, I am working on creating some code that can generate a number based on a probability. How can I accomplish something like this?
for example I want to generate a number that is between 1000 and 20000 where the number will be more likely to be closer to 1000 and exponentially less likely to be away from 1000.
So far I have tried doing approaches similar to:
local minint = 1000
local maxint = 20000
local iter = 4
result = maxint
for j = 1, iter do
result = math.random(minint, result)
end
but the result is not very good because it depends on how high the values are and it does not really let me play around with the distribution curve to get the desired effect.
I’m over my head here, can anyone help?
[import]uid: 48775 topic_id: 8740 reply_id: 308740[/import]
