generating more than one random numbers

hi
I'm trying to generate two different random numbers in the same function but it only generates one and assigns the same number to each different variable. how can i pick two different random numbers for different variables in the same function??
1
2
x = rand();
y = rand();

Two random variables, x and y, with different random numbers.
one more thing can i use this function( assigning random values to variables) more than one time in the main function
for example i want to generate 100 points but doing it with a for loop doesnt work! the points are all the same
1
2
3
4
5
int array[100];
for (int x=0; x<100; x++)
{
  array[x] = rand();
}
Topic archived. No new replies allowed.