I want to generate a random float value between 0 and 1 excluding 1, I.e. [0, 1). I've searched a lot but I couldn't find an answer of this. I've tried the following trick however it generates a negative values
[0, 1)
(double)rand()/(double)RAND_MAX-1;
Aucun commentaire:
Enregistrer un commentaire