R exercise: for loops/sampling distribution

A good friend of mine has been learning how to use R for his research in community ecology for the last year. He reminded me today of an exercise I wrote up for him awhile back to introduce the use of for loops. The exercise is a demonstration of the sampling distribution and goes as such: