You don't need a new generator each time. This line should go outside of the loop.