Advertisement
SteveStage

Worked Random C++

Jul 20th, 2020 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <ctime>
  3.  
  4. using namespace std;
  5.  
  6. int random(int numr1, int numr2) // generate random number from numr1 to numr2 inclusively
  7. {
  8.     return (numr1 >= numr2) ? (0) : ((rand() % ((numr2 - numr1)+1)) + numr1);
  9. }
  10.  
  11. int main()
  12. {
  13.     srand(time(NULL));
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement