Generate Random Number With Specific Data Type
I'm new in c++, and I have question regarding generate random number with a really long integer.
First, I tried like this :
unsigned long long randomNumber1 = rand();
unsigned long long randomNumber2 = rand();
unsigned long long num1 = (randomNumber1 % 8999999999999999999);
unsigned long long num2 = (randomNumber2 % 8999999999999999999);
cout<<"1st random number = " << num1 << endl;
cout<<"2nd random number = " << num2 << endl;
it works fine, but I can not make it exceed 8999999999999999999.
my idea would be to define new data type that is 224 bit integer.
So my questions are :
1. how to define new 224 bit integer?
2. how to generate random number using that new data type?
Topic archived. No new replies allowed.