Fill array with random numbers within a specified range (C++)

You are using exact same integer in each initialization. for loop should be like that

    for(int i = 0; i < size; i++){

        arr[i] =  (rand() % 10);
     }

Leave a Comment