dimanche 29 novembre 2015

Generate random between [0, 1)

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

(double)rand()/(double)RAND_MAX-1;




Aucun commentaire:

Enregistrer un commentaire