All PRNGs repeat eventually since they are all based on seeds that are of finite length. What kind of period do you want? (ie, what is the minimum number of RNs you want to generate before it repeats?) The C RNG has
period 2^32.
Randoms I need would be between 1 and 4, and the seconds randoms from 1 to
13...
Btw, you say that all generators repeat eventually... Isn't that avoidable?
I'm total newb =P
Yes, all PRNGs repeat be design. It has to be that way, because there is only a finite amount of numbers, that can be stored in a value, and PRNGs behave deterministic. But PRNGs vary in the length of the period (normaly 2^32 is enough for almost any purpose) and in the randomness (-> autocorrelation). There are still plenty of tricks to do statistical test and increase the randomness. http://en.wikipedia.org/wiki/Autocorrelation
rand() % 10 returns a random number in [0,10)
so adding 1 will be the result be in [1,11) so you will get a random number from 0 to 10. You can do something similar if you wand the number to be in [10,20]
The % operator returns the value 'thats left', eg 8%3=2 (because 3*n+2=8, the value of n is 2 of course, but that doesn't matter for the result).
And note you need to use srand() when your program starts. If you don't do this already: srand() seeds the RNG, and when you initialize it with the same values the same numbers will come out. time(NULL) from <time.h> is often used as argument for srand(); this function returns the amount of seconds since the first day of 1970 (and so it's different each second): srand(time(NULL))