ou can see on the above link. Any attacker can easily brute force first few million private keys so how to prevent such attack?
Use a good software. Never use a bad wallet when generating your private keys.
What are good software? The most recommended ones:
Electrum, ledger nano, trezor, blue wallet...
You may be using a bad software, which might have a pior randomness and your private keys might be insecure. That is possible.
But if you generated your private keys using the software I suggested, there is no risk of poor randomness