generate large random number in c++ which is closely near to pow(2, 64)-1.
Explain that problem that let say we should generate n random numbers in which mostly is big and stored them in a array.
generate large random number in c++ which is closely near to pow(2, 64)-1.
Explain that problem that let say we should generate n random numbers in which mostly is big and stored them in a array.
The question really needs more clarification. What is 'closely near'? Are you trying to generate weighted random values or is (2^64)-1 the maximum value?
For the sake of providing an answer I assume the latter and that your random value is always positive:
Generation could be done using the standard library:
How to generate 64 bit random numbers?
You need to use uint64_t or similar to store the number. Any smaller and the data could overflow the int bound.
https://en.wikipedia.org/wiki/Integer_overflow