I want to use the For syntax to turn the programme around for N generations. However, I am not quite sure how to use For syntax.
For example, the following list is available. This is the first generation, given an initial value of 10.
initialvalue = 10;
n = 10;
a = PoissonDistribution[initialvalue];
x = RandomVariate[a, n];
b = PoissonDistribution[initialvalue];
y = RandomVariate[b, n];
pairs = Transpose[{x, y}];
pairs = Flatten[RandomSample[pairs, 1], 1]
From the second generation onwards, the formula reflects the values of the previous generation rather than the initial values. The second generation is as follows.
a2 = PoissonDistribution[pairs[[1]]];
x2 = RandomVariate[a2, n];
b2 = PoissonDistribution[pairs[[2]]];
y2 = RandomVariate[b2, n];
f1pairs = Transpose[{x2, y2}];
f1pairs = Flatten[RandomSample[f1pairs, 1], 1]
The third generation is as follows.
a3 = PoissonDistribution[f1pairs[[1]]];
x3 = RandomVariate[a3, n];
b3 = PoissonDistribution[f1pairs[[2]]];
y3 = RandomVariate[b3, n];
f2pairs = Transpose[{x3, y3}];
f2pairs = Flatten[RandomSample[f2pairs, 1], 1]
How to make them calculate 100 times?