MATLAB: Setting Limits on a Random Number Generation

MATLABrandom number generator

I am creating a matrix of numbers with a normal distribution; however, I need to truncate the data so that all random values are between 0 and 100. Below is the code I wrote to produce the random values so far. How would you set limits for the random number generator?
n = 1000;
RQD_mu = 71;
RQD_sigma = 10;
RQD = zeros(n,1);
for i = 1:n
RQD(i) = random('Normal', RQD_mu, RQD_sigma);
end

Best Answer

pd = makedist('Normal', 'mu', RQD_mu, 'sigmal', QRD_sigma);
t = truncate(pd, 0, 100);
RQD = random(t, n, 1);