MATLAB: Generating random numbers from normal distribution

normal distributionstandard normal distribution

Hello,
I generated random numbers from normal distribution for a parameter that has typical values within the range 0.0 to 0.4. The generated random numbers have both negative and positive values. How do I generate only positive values to fit the range of my parameter?
I have another concern:
I understand the random numbers generated from normal distribution in matlab actually come from standard normal distribution. Is there a way to generate from the normal distribution?
Thanks in advance
Best Regards

Best Answer

If you take a random number from a gaussian (aka normal) curve, you can calculate the probability that number would come up.
random = randn();
prob = icdf('Normal', random_value, 0, 1);
You can then, if you know the cdf, calculate the value that would give you that probabiltiy.
example: random_value_my_distribution = cdf('binomial',prob, trials, prob)