=====generate===== Syntax: #include void generate( forward_iterator start, forward_iterator end, Generator g ); The generate() function runs the Generator function object g a number of times, saving the result of each execution in the range [start,end). For example, the following code uses generate() to fill a vector with random numbers using the [[c/other/rand|standard C library rand function]]: vector v(5); generate(v.begin(), v.end(), rand); // Using the C function rand() // Depending on the compiler you may need to put &rand instead cout << "v: "; for (vector::size_type i = 0; i < v.size(); ++i) cout << v[i] << ' '; cout << endl; Related Topics: [[copy]], [[fill]], [[generate_n]], [[transform]]