Usually we do something like a for or while loop with a counter:
for (int i = 0; i < 10; i++)
{
list.Add(GetRandomItem());
}
but sometimes you mix up with boundaries. You could use a while loop instead, but if you make a mistake this loop is infinite...
In Perl for example I would use the more obvious
for(1..10){
list->add(getRandomItem());
}
Is there something like "doitXtimes(10){...}"?