If I want to generate a matrix 10,000 (row) samples of 3 uniform (uncorrelated) variables it is trivial to use antithetic draws to ensure the odd moments such as the mean equal their "true" value. Julia/Matlab code below:
w1=rand(5000,3)
w2 = 1 - w1
w = [w1;w2]
Each column of w will then have mean of 0.5. Can someone please tell me a method of ensuring the covariances equal their "true" values (covariance=0 and variance = 0.0833)? From looking at the MASS package in R it has a function "mvrnorm" that when used with argument "empirical=TRUE" returns multivariate normal samples whose mean and covariance match exactly their true values. I've failed on the web to find out how this is achieved. Any help much appreciated for either multivariate uniform or normal.