+ part1 = rand() & (RAND_MAX - 1);
+ part2 = rand() & (RAND_MAX - 1);
+ // rand only provides 31 bits, and the low order bits of that aren't very random
+ // so we take the high 26 bits of part 1, and the high 27 bits of part2.
+ part1 >>= 5; // drop the low 5 bits
+ part2 >>= 4; // drop the low 4 bits
+ fullRandom = part1;
+ fullRandom <<= 27;
+ fullRandom |= part2;