Hacker News new | past | comments | ask | show | jobs | submit login

1. Count N

2. compute p = n/N

3. select * from table where random()<p*(some lambda >1) order by random() limit n

4. Repeat 3 until you got n rows




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

Search: