Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> (Stated more formally: given non-negative integers k and n with k <= n, generate a list of k distinct random numbers, each less than n. We reasonably ask that this be done in O(k) time and O(1) additional space. Finally, the distribution must be uniform.)

As k approaches n the expected number of draws needed to get k unique values increases faster than O(k).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: