I do have a function in C to give me a unsigned short random number from 0 to 65535.
How can I make it to give me a greater number without much calculating? (r * 65536 + r)
I've made a function in C to do that for me:
static unsigned long convert_random_to_long()
{
static unsigned char row[4];
static unsigned short *p1=&row[0];
static unsigned short *p2=&row[2];
static unsigned long *long_random=&row[0];
*p1=random();
*pt=random();
return *long_random;
}
It gave me a few warnings but worked well.
In C++ it is not giving anymore warnings, simply ends up in errors because of the strict type checking.
How could I make my function work in C++?
Thank you in advance,
misi