How to generate n samples from a peculiar (normally distributed) distribution

Hi,
I am trying to generate n samples from a distribution as follows:
each sample is of size m. Say x is a sample. Then for each of the components {x_1,x_2,…x_m}, x_i follows a normal distribution with mean 0 and variance i^2. Furthermore, the correlation between x_i and x_j is 0.5^{i != j}.

The covariance matrix is easy to code and pass to say MvNormal() function from Distributions. But how do I ensure the variance of each of the components?

I can sample x_i ~ N(0, i^2) individually, and stack up these to do so, but I was wondering if there is a shorter way to do it? Especially ensuring the correlation between the components of a sample.

Thanks a lot

The variance would be the diagonal of your covariance matrix. If you have a correlation matrix, just pre/postmultiply with diagonal matrices that contain the standard deviations. For details, see any basic statistics text or wikipedia.