I know the smallest positive double is 2^1022.
What I mean is your algorithm can't generate all valid random numbers in [0,1).
Your algorithm is like to generate a binary fixed point number of:f=1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and returns f1.0. This is equal to random()/2^32 mathematically (with full
scale computation, certainly). The problem is, if random() outputs a small number,
say 127, we can write the output float as this: 1.111111(in binary)x2^25 The problem here is, the mantissa has only 6 bits. The precision is very bad.
Single precision float format can have 2^22 different numbers in [2^25,2^24),
but your program can only gives 2^6 = 64 of them.
You may argue the probability is very low, but with my test,
it hits 2^27 in less than 30 secons, and hits 0 about 9 times in one hour.
I use your B generator to do the test on a Pentium 4 2GHz CPU.
The smallest positive number your program can give is 2^32 and I met this
number in the onehour test. This number will given as the entire mantissa
field equals 0.
