. Advertisement .

..3..

. Advertisement .

..4..

I need to find a solution for the fill array with random numbers c++ problem. Could you give me some advice? Here is my code:

```
#include <iostream>
#include <ctime>
#include <time.h>
using namespace std;
void initialize(int arr[], int size);
int main(){
const int SIZE = 10;
int myList[SIZE];
initialize(myList, SIZE);
return 0;
}
void initialize(int arr[], int size){
srand(time(0));
int random = (rand() % 9);
for(int i = 0; i < size; i++){
arr[i] = random;
}
for(int j = 0; j < size; j++){
cout<<arr[j]<< endl;
}
}
```

In each initialization, you are properly using the same integer. For loop format should be that:

If you wish to include 9 in your range, you should also write %10. This formula is used to generate random numbers. random = (rand()% (maxValue-minValue+1) +minValue