good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I'm trying to figure out an algorithm for generating a random number that is randomly close to a fixed number such that the results will have a bell curve like distribution. That is, if you ran it thousands of times the answer would be closer to the input most of the time but not all the time. Can anyone help me out with this?
To start you out, here is code to get a smooth distribution (P is short for percentage): Note that the distribution is reasonably smooth... but I want it to clump to the middle in either a bell curve or triangular fashion. Update I suppose I could randomly choose the width of the distribution, that clumps things... it is less than elegant though.
In reply to Curved Random Distribution by Adam
|
|