So I need to generate a very small random number within a range. I've got how to generate a random number between 0 and 1, that would be:
srand(time(NULL));
followed by:
float posx = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
My question is: How can I get the random number to be between, say, 0 and 0.1 or maybe even smaller than that?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire