Comments are excuses for poorly written code
Use a reservoir-sampling algorithm