Is there a single pass algorithm that can produce numbers distributed over part of a normal (Gaussian) distribution?
I want to specify a base value (the center of the distribution), a standard deviation, and a min and max values.
For example I might want all values to be distributed between -0.5 and +1 standard deviations in the same ratio as would be found in a normal distribution (obviously increased to take into account the missing tails).
Obviously one can use a loop and only exit if the generated number was between the minimum and maximum, but that could go on for a long time if min/max are too close together or too far out along a tail.
I'm assuming a language with a Gaussian random number function (I'm using Java, but can read almost anything).