How to draw from exponential distribution in Ruby?
In Ruby, I need to draw from an exponential distribution with mean m.
Please show me how to do it quickly and efficiently. Eg. let's have:
m = 4.2
def exponential_distribution
rand( m * 2 )
end
But of course, this code is wrong, and also, it only returns whole number
results. I'm already tired today, please hint me towards a good solution.
No comments:
Post a Comment