samedi 8 mai 2021

how to generate random numbers without any range in c++ [duplicate]

I know how to use time.h to generate a different seed everytime but using rand() would only get numbers within 0 and the chosen value, for example:

#include <time.h>

srand(time(NULL));
    
int X;
    
X = rand() % 101;

X would be assigned a value between 0 and 100, what should i write to generate random numbers between the lowest possible value for an int(-2147483648) and the highest(2,147,483,647)?




Aucun commentaire:

Enregistrer un commentaire