Can I program a series of analogwrites of different LED intensities?

Hi everyone,
I'm trying to program my Arduino (UNO) to detect the same AnalogRead input but send out an output to the led of different intensities, randomly picked from this list (10,50,150,200,255).
Any tip on how to make that successfully?
thanks!

Store the intensities in a byte array. Use the random function to pick an intensity from the array and write the value to a PWM pin.

If the analogRead is relevant for you problem, please explain.

Thanks, I think I'm stuck on the 'pick a random value from the array'.
Shouldn't random(array_name) do the trick?

Shouldn't random(array_name) do the trick?

Pick a random number based on a memory pointer?
No, that won't work.

Post your code.

Shouldn't random(array_name) do the trick?

No

analogWrite(pwmPin, intensities[random(0, 6)]);

No

That's correct. The array hold 5 values, indexed 0 to 4, so the random function needs to be called with 0 and 5.

thanks everyone! I am now planning a modification, which is a specific sequence from that array of 5 values. Can I somehow just plug in my preferred sequence (of values or indexes) in the analogWrite command?

No, analogWrite writes only a single value, not a sequence.
For a sequence you'll need some form of loop mechanism