Is this a "sound" way to generate a random floating point number?
I'm basically creating an openGL program where I have to determine the size, alpha, accelleration, and color of particles, so they range in the less than 1 range. I am doing it by generating a larger random number and dividing it by a factor to reduce it to a fraction of the larger number for example
I was just wondering, I've never really found much information on random numbers, but is there anything flawed about this strategy, any overhead from the calculations, or will this do?
part.size = static_cast<float>(rand() % ((3 - 1) + 1) + 1 ) / 10; //random size from 1.0 - 3.0
part.dy = static_cast<float>(rand() % ((100 - 25) + 1) + 25 ) / 100; //random acceleration from .25 - 1.0