I'm trying to loop a substitution system where I want the initial condition to be user-defined but the rules that the substitution follows is randomized with each iteration so I thought of compiling a function where x and n are the user input where x is the initial condition and n is the number of iterations required I'm getting all sorts of errors and I would appreciate any assistance.
RandomSA =
Compile[{x, {n, _Integer}},
Module[{f, numb = 0},
f = SubstitutionSystem[{1 ->
Table[RandomInteger[{1, 0}], {3}, {3}, {3}],
0 -> Table[0, {3}, {3}, {3}]}, x, 1];
While[numb < n,
f = SubstitutionSystem[{1 ->
Table[RandomInteger[{1, 0}], {3}, {3}, {3}],
0 -> Table[0, {3}, {3}, {3}]}, f, 1]; numb++]; f]]