If you are not sure what iterators are then think of pointers (they don't have to be pointers but that is an easy way to visualize them for a beginner). The begin points at the first element in the container, and the end points one past the end of the container.
So you can loop like this:
for (I loop = begin; loop != end; ++loop) {
// Do Stuff
auto const& val = *loop; // read the value.
(*loop) = XXX; // write the value.
}
Also this function can be replaced by a one line expression by using std::generate(): or std::iota