3 ms·
GenerateRandomBit() either returns true or false depending on the seed (which gets updated with each call). If it returns true on the first iteration then dataP
by wizofaus 4y ago
GenerateRandomBit() either returns true or false depending on the seed (which gets updated with each call). If it returns true on the first iteration then dataPointer[0] will be OR'd with 1 (i.e. set to "1"), otherwise it will be left as 0. For the next iteration, dataPointer[0] is conditionally OR'd with 2 etc. (until iteration 32, where it starts updating dataPointer[1]).
- valrix 4y agoAhh, okay now I'm understanding what's going on. Only dataPointer[0] is used unless it's a double, which will cause the pointerIndex to increase to 1 once the first 32 bits are set. Otherwise char[] will flip any/all of the first 8 bits, while int[] and float[] will be flipped for up to 32 bits at dataPointer[0]. Thanks for the explanation!