views:

105

answers:

2

This picture from wikipedia has a nice example of the sort of functions I'd ideally like to generate

http://en.wikipedia.org/wiki/File:Normal_Distribution_PDF.svg

Right now I'm using the Irwin-Hall Distribution, which is more or less a Polynomial approximation of the Gaussian distribution...basically, you use uniform random number generator and iterate it x times, and take the average. The more iterations, the more like a Gaussian Distribution it is.

It's pretty nice; however I'd like to be able to have one where I can vary the mean. For example, let's say I wanted a number between the range 0 and 10, but around 7. Like, the mean (if I repeated this function multiple times) would turn out to be 7, but the actual range is 0-10.

Is there one I should look up, or should I work on doing some fancy maths with standard Gaussian Distributions?

A: 

I see a contradiction in your question. From one side you want normal distribution which is symmetrical by it's nature, from other side you want the range asymmetrically disposed to mean value.

I suspect you should try to look at other distributions density functions of which are like bell curve but asymmetrical. Like log distribution or beta distribution.

nailxx
I never said I wanted a normal curve; just a probability function that is shaped like the one with mean=-2 in the linked picture. I'll look into those, thanks =)
Justin L.
That shape is still normal, and thus symmetric. The figure is misleading because it suggests that the range is constrained to the visible part of the x-axis shown, which is not the case, it extends to infinity in both directions. The probability of drawing from the distant tails gets fantastically small but remains non-zero. In practice you could probably clip, but your distribution would still not be what you want. I suspect the simplest approach would be to average draws from a triangular distribution with the desired mode, but I'd need to work through that to be sure.
walkytalky
No, come to think of it, that will just tend to normal as well -- hello Central Limit Theorem!
walkytalky
A: 

Look into generating normal random variates. You can generate pairs of normal random variates X = N(0,1) and tranform it into ANY normal random variate Y = N(m,s) (Y = m + s*X).

Grembo