cppreference.com > C++ Algorithms > generate_n
generate_n
Syntax:
  #include <algorithm>
  iterator generate_n( iterator result, size_t num, Generator g );

The generate_n() function runs the Generator function object g num times, saving the result of each execution in result, (result+1), etc.