Using rand() and srand()

I'm trying to put random integers into a vector using rand() and supplying srand() with a seed value of 1. I was supplied a list of integers that I should get with this seed value but they don't match with my results. I'm not sure if anyone has any ideas as to why they don't match or where I may be going wrong. I'm not sure if it has something to do with my coding or if the numbers may not match because I'm using a different compiler or environment than the original numbers were generated or if that doesn't matter. When I transfer my source files onto the virtual machine where the other set of integers were made I still get a different set of integers.

Here is my function for generating the integers and adding them to the vector

void genRNDNums(vector<int>& V)
{
srand(SEED); //calls srand and supplies the SEED (1)

int value; //variable to store the random value generated

for(int i = 0; i < VEC_SIZE; i++)
{
value = rand() % (HIGH - LOW + 1) + LOW;
V.push_back(value);
}
sort(V.begin(), V.end());
}

Any help or pointing int he right direction would be appreciated.
Your coding is fine. I believe he same seed can generate different sets of numbers depending on how the particular library implements rand().
Topic archived. No new replies allowed.