This question already has an answer here:
I'm a newbie to Bitcoin, so I apologize if this seems like a "noob" question.
So, from what I've read: anyone can create a new Bitcoin wallet. Upon creation, a wallet address is automatically generated. The wallet address can be used by others to make transactions to that particular wallet.
Now, my question is, what guarantees that two automatically generated wallet addresses will be unique? If my friend and I created separate wallets on our own computers offline, then what is the guarantee that the two wallet addresses will be unique? What if the two randomly generated wallet addresses turned out to be the same?