News for hackers. Stuff that matters.
Re:Help wanted: Google hiring in 2011 by nostrademons on Wednesday January 26, 2011 @01:59AM (#2142440)
I cheated. I googled it:

http://stackoverflow.com/questions/1840618/fast-random-selec...

BTW, this actually is a practical question, because it's isomorphic to "How do you select a random element from a stream of elements when you don't know the length of the stream a priori?" This is crucial for many online algorithms. For example, imagine that you're FaceBook and you're trying to display a News Feed of a massive number of events coming in from a large number of apps. You don't have the computational power to handle all of them, and so you need to drop some of them on the floor. How do you fairly drop events and display only a random sampling of them?

There are no comments on this comment yet.