i need a library with functions for generating random number, given average, standard deviation and using one of three distribution – exponential, normal or unified.
even one of the three would help.
i’m looking for something like this – http://www.codeproject.com/KB/recipes/zigurat.aspx, but in c.
thanks
uniform:
Generate a random number in the range [0,1] with uniform distribution:
Exponentional
generating an exponentional random variable with parameter lambda:
normal:
the simplest way [though time consuming] is using the central limit theorem, [sum enough uniformly distributed numbers] but there are other methods in the wikipedia page such as the box muller transform that generates 2 independent random variables: X,Y~N(0,1)
transforming from X~N(0,1) to Z~N(m,s^2) is simple:
Z = s*X + mThough you CAN generate these random numbers, I stand by @Amigable Clark Kant suggestion to use an existing library.