I am having troubles getting this program to generate random numbers. Right now i have it set up to only generate 1 and 19. I do not know how to generate random numbers.
thank you if anyone can help my dumbass.
change a = lowest+int(range*rand()/(RAND_MAX + 1.0)); to a = (rand() % highest) + lowest;
This takes the random value, divides it byhighest and keeps the remainder (0-18) then adds 1 (0-19)
Now you're a smartass :mrgreen:
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Really? . . . http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx
Either way works, and some would recommend the OP's way over yours (myself included).
Thanks for the link. Interesting.... I'm convinced
I also noticed an error in my solution. So go ahead and use your original equation. :o
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944