Manipulate[
f[n_] := 1/n^2;
pt = Accumulate[Table[Table[f[i], {i, max}][[n]],
{n, PermutationReplace[Table[i, {i, max}], RandomPermutation[max]]}]];
DiscretePlot[pt[[n]], {n, 1, max}],
{{max, 5}, 2, 15, 1, Appearance -> "Labeled"},
Deployed -> True]
The problem is that Mathematica constantly reevaluates the randomization. Even if the mouse is completely outside the Manipulate, the plot constantly flashes and changes.
But now here goes the really weird part. If the whole Manipulate gets a bit less complex... this behaviour ceases.
Manipulate[
pt = Accumulate[PermutationReplace[Table[i, {i, 1, max}],
RandomPermutation[max]]];
DiscretePlot[pt[[n]], {n, 1, max}],
{{max, 5}, 2, 15, 1, Appearance -> "Labeled"},
Deployed -> True]
Everything looks nicely here. Yes, it does seem Mathematica re-randomizes this two or three Times too often, so it takes a second for the plot to calm down and stop changing; but after that time, everything looks well.
How to fix this? And why does this happen?
PS. Sorry for spamming the site... I really need to have a better knowledge of Mathematica, I know. But, for my defence, this really seems weird and unandersandable.

Initializationoption to initialize the function rather than have it in the body as others have pointed out. – Mike Honeychurch Jan 14 '15 at 05:24