vendredi 20 février 2015

If srand() takes 32-bit int... Why does rand() not return same?

Cross-platform, the limitation of standard rand() is that you can only rely on it to generate 16-bit shorts... you can bitshift to create longer numbers from these, but it's an inconvenience.


Why is it that although rand() only effectively returns up to a 16-bit value, srand() takes 32-bit int to seed that same process?


Aucun commentaire:

Enregistrer un commentaire