Because sometimes I wanted to rand ()
to generate numbers over 32767. Is there have a way to extend the limit of rand()
and can generate a larger random number for my program. An example:
#include <cstdlib>
using namespace std;
int main() {
srand(9439);
for(int i = 0; i < 15; i++){
cout << 1 + (rand() % 500000) << endl;
}
}
So, the result never goes beyond 32767. Is there have a way to let rand()
generate random numbers over 32767?
Aucun commentaire:
Enregistrer un commentaire