Macros & INT type

32,767 || RAND_MAX. sence 32,767 is defined as "short int," is it possible to generate a random number using a different Int? like the type "unsigned int?
You can write your own random generator function or class and use it with any type you want
This is what I do when I want 32 random bits and don't feel like using Mersenne's (note: it assumes RAND_MAX to be 2^15-1 and unsigned to be of size 4):
((unsigned)rand())|(((unsigned)rand())<<15)|(((unsigned)rand())<<30)
Topic archived. No new replies allowed.