given m<n, generate random numbers of m within range(0..n).
select = m
But when n was large, it meets bootleneck. Improve with:
talk to user
get a clean, crisp problem statement.
think for a day and code for a min rather than per contra
choose the best
Polya’s delightful How to Solve It can help programmer become a better problem solver.