Probability of a duplicate random alphanumeric string with 2x weight on letters Ran into this interesting problem at work the other day.
We generate fake email addresses using an random alphanumeric generator to use to register on our site. However, the random alphanumeric generator function we use is case-sensitive (would generate a or A) whereas emails addresses are not (so abc@mail.com is the same as ABC@mail.com). The other day we generated an email address that happened to be duplicate of one we had already generated.
What is the probability of generating a duplicate random alphanumeric string of n-length where letters are weighted 2x as compared to a "normal" alphanumeric string (36 different values)?
Hope I was as clear as possible. Let me know if I can clarify anything else.
 A: Here's the start of an answer, dealing with the probability that two randomly generated strings match when you ignore case. You'll need this information when you answer @Thanassis comment to clarify the context.
The best way to tackle a problem like this is to look at small cases. Suppose first that you have only alphabetic strings, that $n=1$ and that the first string is "a". Then the chance that the second one letter string matches "a" is $2/52 = 1/26$ since both "a" and "A" do the job.  
The calculation for alphanumerics is a little more complicated. If the initial string is alpha (of length 1) then the probability of a match is $2/(52+10) = 1/31$. If the string is numeric then the probability is just $1/62$.
So for a string of length $n = a + b$ where $a$ is the number of letters and $b$ the number of numbers the probability of a match is
$$
\frac{1}{31^a 62^b} = \frac{1}{2^b 31^n} .
$$
Next steps would be finding the probabilities of $a$ and $b$ given $n$ (binomial coefficients here), then taking into account the number of previously generated strings you might match. 
Unless you generate lots of these fake emails the chance of a duplicate is pretty small: $31^{-6}$ is about one in a billion.
A: The probability of matching $n$ characters is the probability of matching each character in turn. So calculate the probability of matching one character and then raise to the power $n$.
Let's say that the 2 strings generated are P and Q and let P[1] be the 1st character of P.
Then
Pr(P[1]=Q[1]) = 
Pr((P[1]=Q[1]) AND (P[1] is alphabetic)) + Pr((P[1]=Q[1]) AND (P[1] is numeric))
Pr(P[1] is alphabetic) = 52/62 = 26/31, and we match with probability 2/62, so the first part of the sum is 26/961.
Pr(P[1] is numeric) = 10/62 = 5/31, and we match with probability 1/62, so the second part of the sum is 5/1922.
Overall the probability of a match is 57/1922, and So for an $n$-character string, the probability is $(57/1922)^n$
But this isn't really solving your problem. It's only addressing a single pair of strings. You were surprised to get a repeat, but ask yourself how many strings you had previously generated. Any one of those could have provided the match!
So a better approach would be to ask 'what is the probability I got a repeat having generated $N$ strings of length $n$?'
Or, equivalently, 'what is the probability I got no repeats having generated $N$ strings of length $n$?'
The second question turns out easier to answer, but it's still rather tricky, requiring a large amount of multinomial computation.
However, using the calculation above, we can at least calaculate the expected number of repeats. If we have $N$ strings, we have $NC2$ = $N(N-1)/2$ comparisons.
Therefore the expected number of repeated pairs is
$(57/1922)^n N(N-1)/2$
