Assume a data file with 80+ million ones and zeros, randomly generated.
From this file, we want to create a list of random decimal integers.
This is the plan to do this conversion.
- Divide the 80 million digits into groupings of 4 binary digits.
- Convert each 4-digit binary to decimal.
- Discard all decimal values greater than 9.
This should result in a string of random integers from 0-9
Here is the concern. The 24 binary digits that comprise the 6 groupings of 4 binary digits that correspond to the values 10 to 15 contain 17 ones and only 7 zeros. Will this imbalance affect the distribution of even vs. odd integers, or compromise randomness of the final string of decimal digits in any way?
Update: From the answers posted, it seems the method enumerated above is sound. I agree with that conclusion. However, I still do not understand why removing more than twice as many ones as zeros from the binary string does not bias the outcome toward fewer odd numbers. I seek explanations.