Why does C++ rand() seem to generate only numbers of the same order of magnitude?
You need to be more precise: you want different base 2 logarithm values but what distribution do you want for this? The standard rand() functions generate a uniform distribution, you will need to transform this output using the quantile function associated with the distribution that you want.
If you tell us the distribution then we can tell you the quantile
function you need.