From: Osman Tuna on
I wrote a code to show simplified epidemic spreading, but there is a problem, I want to see 100, 150, 200... steps for same epidemics, in this code for every loop, only starting point is same, first, second, third... steps have new values, how can I see 150th steps which starts from 100th step value of same epidemics?


Manipulate[
SeedRandom[seed];
(* Let's choose initial condition *)
mylist = Table[RandomInteger[{20, p}], {RandomInteger[{10, r}]}];

For[mylist; n = 0, n < q (* q determines the number of steps *), n++,
(* Let's decide how these illnesses spread or disappear *)
mylist = ReplacePart[mylist,
RandomChoice[mylist -> Table[i, {i, Length[mylist]}], 1][[1]] ->
mylist[[RandomChoice[mylist -> Table[i, {i, Length[mylist]}],
1][[1]]]] +(*
Now decide how the number of infected people change,
it can decrease because of death or recovering from the illness \
*)RandomInteger[{-5, 10}]]];

ListLogLogPlot[Reverse[Sort[mylist]], AxesOrigin -> Automatic,
Joined -> True,
AxesLabel -> {"epidemic types", "infected people"}], {{p, 60,
"infected people"}, 40, 80, 5,
Appearance -> "Labeled"}, {{r, 30, "epidemic types"}, 20, 50, 5,
Appearance -> "Labeled"}, {{q, 250, "steps in epidemic"}, 100, 500,
50, ControlType -> Setter},
{{seed, 1, ""}, Button["random seed", seed = RandomInteger[1000]] &},
TrackedSymbols -> {p, r, q, seed}
]