Random number

I made a function which, normally, generates a random number. But when i run the program it always shows this result

2 8 5 1 10 5 9 9 3 5 6 6 2 8 2 2

This is my code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  #include<iostream>
#include<stdlib.h>

using namespace std;

void generate_number()
{
   int rand_num=rand() % 10+1;
    cout<<rand_num<<" ";
}

int main()
{
    for(int i=0; i<=15; i++)
    {
         generate_number();
    }
}


Maybe i must initialize it in some way but i don't know how.
Can anyone help me?
Topic archived. No new replies allowed.