Hi, I'm trying to generate a random number between 50 and 1000(inclusive) in increment of 50.
I'm using the libraries
Here's the actually code I'm using.... I'm calling this function inside of a loop in the main function. I'm getting the correct numbers but I am occasionally getting 0 and the same number often repeats itself.Code:#include <ctime> #include <cstdlb>
Code:int getspin() { srand(time(NULL)); int x; x = (rand()%1001 +50)/100 *50; return x; }