# Update Random Each Repetition of Animate

I found a solution that's not what I wanted but it will suffice Thanks - Larry

col = RandomChoice[{Blue, Red}];
frames = Table[Graphics[{
col, Disk[{5*t - 5, 5*t - 5}, .5]},
PlotRange -> {{-5, 5}, {-5, 5}}],
{t, 0, 2, .03}];
ListAnimate[frames, 50]
• Easiest fix is to use col := RandomChoice[{Blue, Red}];. The way you have it, col is defined once before the Table. With :=, it is recomputed each time. See reference.wolfram.com/language/ref/SetDelayed.html for more info. Mar 19, 2023 at 17:39
• No. That just updates for each frame. I wanted it to update only when the animation starts over. Mar 19, 2023 at 19:26
• I tried that suggestion and it doesn’t work. ?? Mar 19, 2023 at 21:28
• I found a solution that' s not quite what I wanted but it will suffice. Thanks - Larry frames = {}; For[k = 1, k < 5, k++, col2 = RandomChoice[{Blue, Red}]; frame2 = Table[Graphics[{col2, Disk[{5*t - 5, 5*t - 5}, .5]}, PlotRange -> {{-5, 5}, {-5, 5}}], {t, 0, 2, .2}]; frames = Flatten[Append[frames, frame2]];] ListAnimate[frames, 5, AnimationRepetitions -> 1] Mar 20, 2023 at 3:27

Not continuously random but random for 20 sets. If a viewer sees the repeating pattern with the 20 sets, they need a life.

frames = Table[Graphics[{c, Disk[{5*t - 5, 5*t - 5}, .5]},
PlotRange -> {{-5, 5}, {-5, 5}}], {t, 0, 2, .03}];
ListAnimate[Flatten[Table[frames /. c -> RandomChoice[{Red, Blue, Green, Cyan, Orange, Black}],
{i, 1, 20}], 1], 100]

• Thank you JimB, infinite unnecessary. Much better than mine - Larry Mar 20, 2023 at 14:13

Putting the definition of col in a Module works:

frames := Module[{col},
col = RandomChoice[{Blue, Red}];
Table[Graphics[{col, Disk[{5*t - 5, 5*t - 5}, .5]},
PlotRange -> {{-5, 5}, {-5, 5}}], {t, 0, 2, .03}]
];

ListAnimate[frames, 50]
• Don’t know why this doesn’t work on my Dell Intel I5, Mathematica 11.2 Home Edition, Win 11. Only updates when it’s re-executed. Mar 20, 2023 at 21:32
• I guess I still didn't get what you're looking for -- this does generate a new color each time ListAnimate is run. Sorry! Mar 20, 2023 at 21:38
• All set now Cris K. I appreciate your help, it’s my first animated rodeo. Mar 21, 2023 at 11:53