Hacker News new | ask | show | jobs
by customguy 22 days ago
I understand none of that, but there's a little snippet from roguebasin I find myself re-using all the time because it's so versatile:

https://www.roguebasin.com/index.php?title=Weighted_random_g...

You start with a weight of 1 and you just have things affect the weights, e.g.

- for every time it's been played before, multiply the weight with 0.1

- if the total number of tracks is N, and it was among the last N/2 songs played, set weight to 0

- for every word in title, filename, artist, album etc. that the last played song had, penalize tracks for any of those words they have

- if the song has a very similar length than the last song was played, it gets a penalty