inserting random integers to a vector

I am writing a function that calculates the time that is needed to add a number of integers which i have specified in main...However i want that the integers that will be inserted must be randomly inputet by the computer.how can i do this is a tentative of mine but i am not quite sure of it.so i am inserting n-number of integers and n i have specified in main..And i want that the integers to be random..




double testListBack(int n) {

int max = n;

list<int>l;

clock_t ts = clock();
for (int i=0; i<max; i++) {
int a;
a = rand();

l.push_back(i);
}
clock_t tf = clock();
double dt = (double) (tf-ts) / CLOCKS_PER_SEC;

cout<<"\t" <<" List time : "<<dt<<endl;


return dt;
}
Topic archived. No new replies allowed.