logoalt Hacker News

shakow • today at 6:39 AM • 0 replies • view on HN

> Just generate a random number modulo the number of files, and then play that file

That won't be uniform. If you want really random shuffle, mod to the closest next power of 2 then re-sample until you get a number within the bounds.