Generate Sequence with given variance and mean Is there a simple way to do this by hand?
I mostly want to do this for quick "straight face" testing to see if something works, so ideally I want (for example) a sequence with mean 1 and variance 2 with as many 0's as possible (for ease of calculation).
Is there an easy way of doing this?
 A: If the "as many 0's as possible" isn't an absolute requirement but more something to aim toward, consider a very simple sequence of $0$'s and $a$'s.
If you had an infinite random sequence of 0's and 1's and the proportion of 1's was $p$, then the mean would be $p$ and the variance would be $p(1-p)$.
If the sequence was multiplied by $a$ (i.e. consisted of $0$'s and $a$'s), then the mean would be $ap$ and the variance $a^2p(1-p)$.
Consequently to achieve mean $\mu$ and variance $\sigma^2$, note that the square of the coefficient of variation, $\sigma^2/\mu^2 = \frac{a^2p(1-p)}{a^2p^2}=(1-p)/p$.
Consequently $p = 1/(1+\sigma^2/\mu^2)$.
Once $p$ is known, you have $a=\mu/p$.
So in your example, $\sigma^2 = 2$ and $\mu=1$, whence $p = 1/3$ and $a=3$.
That is an infinite sequence of 0's and 3's where 2/3 of the values are 0 and 1/3 of the values are 3 has mean 1 and variance $9\cdot \frac{2}{3}\cdot\frac{1}{3} = 2$.
(If you have a finite sequence, note the distinction between the sample variance with Bessel's correction and the population variance. That aside, the basic principle is the same.)
This may not be the highest possible proportion of 0's, but it's pretty high, and is relatively easy to solve for.
