That's statistics, it only works properly if the sample size is large enough.
With two constraints (mean, and std) only two out of your four numbers are truly random. If you really wanted to, you could generate two random numbers and then solve for the last two:
%generate two random numbers: a,b
%a+b+x+y = 4*mu %definition of mean, x and y unknown.
%gives: y = (4*mu-a-b) - x (eq. 1)
%(a-mu)^2 + (b-mu)^2 + (x-mu)^2 + (y-mu)^2 = 3*sigma^2 %one of the definition of std, (eq.2)
%substitute y from eq. 1 in eq. 2 and solve quadratic equation for x
Best Answer