My question is how to choose n element from vec.begin() to vec.end() such that we almost cover all the vector elements?
vector<double> take_100_samples(vector<double>& in)
{
vector<double> vec(100);
double step = (in.size() - 1) / (100 - 1);
// sampling process
return vec;
}
for example if in vector has size of 200, we choose every two element of it (i.e. in[0], in[2] , in[4], ... ,in[199]) but what if the size is not dividable by 100?
Is there efficient way for doing that?
Regards