I added a corrected question. It was addresses I was thinking of, not public keys. That's my fault (I'm still new to HOW Bitcoin and others work, which is also why I'm asking the question, :p).
So address-wise... how are you able to sweep all possible addresses when they are generated randomly to begin with?
As Foxpup said, the private key really only corresponds to one address. All sweeping means is that you spend whatever is in that address and send it to a new one.
Imagine having an online wallet with address A
And a cold offline wallet with address B, where I've written the private key on a piece of paper.
If I open my online wallet and sweep that offline private key that corresponds to address B then it'll send whatever is in B to address A. My online wallet still only has address A, but it has all the coins from B in that address A as well.
That's different than importing a private key. If I imported the private B key into my online wallet then it would have both addresses A and B.
I was under the impression, though, that I could have (I'm shortening addresses for brevity):
One wallet with its private key. 5 Addresses with the following balances:
1jAdjflsjkfsdf32423lk - 0.01 BTC
1jAdjflsjkfsdf23j44lkl - 0.03 BTC
1jAdjflsjkfsdf234234 - 0.03 BTC
1jAdjflsjkfsdf23j423l - 0.03 BTC
1jAdjflsjkfsdf2342l3l - 0.05 BTC
Now, my understanding is that you could use a "sweeper" (or import, maybe?) to take
just the private key and automatically know that there are 0.15 BTC associated with it (by taking all of the possible addresses and pulling in their balances). Is this where my understanding was wrong?