Currently, my solution is to compute (float) (2 * (rand() % 2)) - 1. Are there more efficient ways of doing this, for example by producing random bits and placing them at the respective position for the sign of a 1.0 float constant using bit-twiddling?
Aucun commentaire:
Enregistrer un commentaire