From: Barrie Stokes on
Hi

In contrast to some of the answers you've already received, I thought you might be looking for random numbers that have a truncated Gaussian distribution.
I'm taking your term "comply" to mean the distribution does conform to a Gaussian PDF (Probability Density Function), but only between given limits.
I would be interested to hear about the context of your question; you might be asking, and I might be answering, the wrong question. :-)
I had need of something similar for the multivariate Gaussian just earlier this week - this was the essence of my approach:

ClearAll[ restrictedGaussian ]
restrictedGaussian[ mean_, sd_ , low_, hi_ ] := Module[ {n, rn},
n = 1;
While[ True,
(
rn = RandomReal[ NormalDistribution[ mean, sd ] ];
If[ low < rn < hi, Break[ ] ]
);
n++ ];
rn ]

restrictedGaussian[ 1, 1 , -3, 3 ]

restrictedSample = Table[ restrictedGaussian[ 2, 1 , -3, 3 ], {10000} ];
% // Short
Histogram[ restrictedSample ]

restrictedSample = Table[ restrictedGaussian[ 0, 2 , -4, 4 ], {10000} ];
% // Short
Histogram[ restrictedSample ]

Your question perhaps:

restrictedSample = Table[ restrictedGaussian[ 0, 1 , -4, 4 ], {10000} ];
% // Short
Histogram[ restrictedSample ]

Hope this could someday be useful.

Barrie

>>> On 16/05/2010 at 7:57 pm, in message <201005160957.FAA03713(a)smc.vnet.net>,
"elvisgraceland(a)gmail.com" <elvisgraceland(a)gmail.com> wrote:
> Dear experts,
> Is it possible to generate random numbers b/w any two limits (say b/w
> -4 & 4 ) which would comply to a gaussian distribution ?