I think I understand that m_ulRandomSeed >> RANDOM_SHIFT is the equivalent of dividing m_ulRandomSeed by 2^16. Is this right? I'm also wondering about the purpose of "comparing" m_ulRandomSeed with MAX_UNSIGNED_SHORT using &, and what it would result in... can you help me out? Thanks!
Note 1: The & is just making sure that the result from m_ulRandomSeed >> RANDOM_SHIFT is NO greater than 16-bits.
It is a bit-wise AND(&) not logical AND(&&).
1 2 3 4 5 6 7
0x5 in binary is 0101
& &&&&
0x4 in binary is 0100
_____________________
0100
Therefore 0x5 & 0x4 = 0x4(bit-wise),
0x5 && 0x4 = true(logic).
So, if the value of m_ulRandomSeed >> RANDOM_SHIFT was 0x54321
But how can m_ulRandomSeed be greater than 0xffff if it's already been divided by 2^16 and is an unsigned long? :-) But I get the picture thanks a lot!