HCHTech
Well-Known Member
- Reaction score
- 3,828
- Location
- Pittsburgh, PA - USA
Ok, I had a slow afternoon, I admit it. This morning, one of my guys was putting in the 14th 2FA code of the day and commented that "there sure seem to be a lot of 2FA codes with duplicate numbers in them - I wonder how close these things are to truly random?"
It seems to me that the odds of this outcome are pretty high (having 2 of the digits match in a 6-digit code), but for sure this is a calculable thing. I spent an embarrassing amount of time trying to find the formula for calculating a probability like this, but came up empty.
Just trying to think through the problem a bit:
We have 6 digits, each of which could be between 0 and 9.
This means there are 10^6 possible outcomes for a six-digitcode.
Any digit has a 1 in 10 change of being any particular number.
If we assume the first digit is "1", then the odds that there will be another 1 somewhere in the following 5 digits would be .1+.1+.1+.1+.1, or 50%. I think -haha
BUT, we're not trying to calculate the odds of getting two 1's, but rather that there are ANY two digits that match, which makes me think I need a ^10 in there somewhere.
We're also NOT trying to calculate the odds that there would be ONLY 1 pair of matching digits, that would require the addition of the chance any digit would NOT match (9/10).
One of you folks did better in statistics than I did, I'm sure. How do I calculate this correctly?
It seems to me that the odds of this outcome are pretty high (having 2 of the digits match in a 6-digit code), but for sure this is a calculable thing. I spent an embarrassing amount of time trying to find the formula for calculating a probability like this, but came up empty.
Just trying to think through the problem a bit:
We have 6 digits, each of which could be between 0 and 9.
This means there are 10^6 possible outcomes for a six-digitcode.
Any digit has a 1 in 10 change of being any particular number.
If we assume the first digit is "1", then the odds that there will be another 1 somewhere in the following 5 digits would be .1+.1+.1+.1+.1, or 50%. I think -haha
BUT, we're not trying to calculate the odds of getting two 1's, but rather that there are ANY two digits that match, which makes me think I need a ^10 in there somewhere.
We're also NOT trying to calculate the odds that there would be ONLY 1 pair of matching digits, that would require the addition of the chance any digit would NOT match (9/10).
One of you folks did better in statistics than I did, I'm sure. How do I calculate this correctly?
Last edited: