What do you think about this uint64 random generator?
DONT DO THIS

while (i--)
{
    myRand += rand();
    if (i)
    {
        myRand &lt;&lt;= numberOfBits;
    }
}


It seems like you are trying to increase the range of random numbers.
What you are doing is screwing up the distribution of the random numbers and thus making them less random. Have you tried plotting a histogram to show the distribution.

Luckily for you your system probably only has 32 bit rands and thus this is not changing anything; as the loop is only done once.

ASSUMPTION HERE

static const unsigned long uint_max = 0xffffffff;  // assuming that long is 32 bits

// long has at least 32 bits but can be larger.


Is this not the whole point of all the work to avoid this:

    if (high &lt; RAND_MAX)
    {
        return (rand() &amp; high);  // basically this is the same as using 
    }                            // % high. You are folding at high
                                 // unless RAND_MAX is a multiple of high
                                 // then you have an uneven distribution.


There is plenty of documentation on the web of how to do this correctly please try and find rather than re-invent something like this. Random number generation is a non trivial task and exceedingly hard to get correct. Don't mess with it unless you have a PhD in probability.

Rand done properly: https://stackoverflow.com/a/10219422/14065