News for hackers. Stuff that matters.
Re:Show HN: Grab a Random ArXiv Paper by jegp on Saturday June 07, 2025 @03:06PM (#44211830)
Is the code for the "feeling lucky" selection mechanism open? Or, do you know how they select papers at random?
Re:Show HN: Grab a Random ArXiv Paper by dginev on Sunday June 15, 2025 @05:27PM (#44285091)
Sure, the repository is open source (linked from the front page).

The selection did not get much thought at all, just a Rust rand shuffle over all ids performed at first page visit and then cached: https://docs.rs/rand/latest/rand/seq/trait.SliceRandom.html#...

I had all IDs already computed for the previous/next article navigation feature, so it seemed fun to reuse them.