I was playing with a Manipulate
to visually compare calculating the mean of Normal and Cauchy random data.
Manipulate[
ListLinePlot[
{
Table[Mean@Take[#, i], {i, 1000}] &[
RandomVariate[NormalDistribution[10, 1], 1000]],
Table[Mean@Take[#, i], {i, 1000}] &[
RandomVariate[CauchyDistribution[10, 1], 1000]]
},
PlotRange -> Full,
DataRange -> n,
Frame -> True,
Axes -> False
],
{n, 50, 1000}
]
The result looks nice, but there is one problem. It regenerates the random data each time I move the slider for n
. Is there some way I could set it up so that is only generates new random data when the Manipulate
is first evaluated and when a button is pushed?