Home > Enterprise >  Is getrandmax() a fix number?
Is getrandmax() a fix number?

Time:09-13

In getrandmax() i get a value max of 2147483647
It is the same on all the computer, or does it change and can be increased/decresed ?

CodePudding user response:

getrandmax() will typically be tied to the system architecture. The highest unsigned number.

For example 2147483647 is 2^31-1.

Other systems may have 2^15-1 = 32767 (documented as on some Windows systems).

I’ve yet to see a 64 bit version. But it would be 2^63-1 = 9223372036854775807.

  • Related