Number range, not random

Hi

I have a single line for my XML gallery,that I’m have a few troubles with.

I want to tell the gallery that after it has loaded all the thumbnails; to perform a function on the the 5th thumbnail up to the 40th.

gal[“thumb”+(5+random(40))].gotoAndStop(2);

So far, I’ve just managed to tell it to randomly select any thumbnails from 5 to 40. I need EVERY thumbnail from 5 to 40.

Any ideas?