Use seed(int value) to set the seed and then use rand(float from, float to) so that you can get a specific range. If you need it to be an integer, use round(float value) on the value that rand returned.
If that way doesn't work, you can take the large integer value you were getting and use fmod(randomnum, maxvalue_possible). This will make it so that the number returned cannot be larger than you want.