Hey guys, I'll be googling and such and will probably find the answer before someone can reply, but in case this problem is trickier than it seems, here's the problem I am having.

Basically, I never needed to have a random number that was bigger than 0x7fff (a little over 32000 in decimal) until now. But I want to be able to generate a random number that is say, a number between 0 and 1000000. How can I do this, and still have the number be truly random, i.e. each number between 0 and 1000000 is just as likely?

edit: I think I just figured it out just by thinking about it

the answer is rand() * MAX_RAND + rand()