# What is the correct way to plot a dynamically generated list of functions?

For example, I want to generate a list of random waves and plot them.

Then I wrote

f:=Random[Real]
h:=Floor[f*20]


And then

Manipulate[Plot[Table[f Sin[h x + h t], {n, 0, 5}], {x, -5, 5}, PlotRange -> {-2, 2}], {t, 0, 10}]


But it turned out a mess.

I tried to fix it with

a = Table[f Sin[ h x + h t], {n, 0, 5}]
Manipulate[Plot[a, {x, -5, 5}], {t, 0, 10}]


But no graph was generated.

Finally I tried

a = Table[f Sin[ h x + h t], {n, 0, 5}]
Manipulate[Plot[a /. t -> b, {x, -5, 5}], {b, 0, 10}]


This time the graph was correct. But there are still 2 problems:

1. All functions are in the same color.
2. It lags a lot when I tried to manipulate t.

These problems don't exist if you write by hand the list inside plot.

So what is the correct way to solve these problems and get the desired output?

I used 3 rather than 6 functions for each plot and used a Frame rather than Axes to reduce the clutter.

f := RandomReal[];
h := Floor[f*20];


When the Table is inside of the Plot use Evaluate

Manipulate[
Plot[
Evaluate[
Table[f Sin[h x + h t], {3}]],
{x, -5, 5},
PlotRange -> {-1.1, 1.1},
Frame -> True,
Axes -> False],
{{t, 5}, 0, 10, 1, Appearance -> "Labeled"}] Manipulate[
a = Table[f Sin[h x + h t], {3}];
Plot[a, {x, -5, 5},
PlotRange -> {-1.1, 1.1},
Frame -> True,
Axes -> False],
{{t, 5}, 0, 10, 1, Appearance -> "Labeled"}] Similarly, the ReplaceAll needs to be in an Evaluate

a = Table[f Sin[h x + h t], {3}];
Manipulate[
Plot[Evaluate[a /. t -> b], {x, -5, 5},
PlotRange -> {-1.1, 1.1},
Frame -> True,
Axes -> False],
{{b, 5}, 0, 10, Appearance -> "Labeled"}] 