Replenishment of C++ unit size



  • The unit m[15] shall be filled with random numbers. I tried that.

    for(i = 0; i < 15; i++) { m[i] = rand() % 100; }
    

    The program works, the numbers go, but somehow it's always the same, that is, it always creates the same mass with the same numbers. How do you make every number different?



  • Start the program.

    #include <ctime>
    

    srand(time(NULL));


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2