Randomly choosing books

I have this list of the unread books on my shelves, alphabetized by author's last name, and I'm trying to make progress on reading (or at least skimming) them. In order to provide some variety, each time I finish a book, I use a random number generator to pick which one to read next.

For a while, I was using web services for this. I would Google [random number 1-350], for example, and it would take me to a page that would give me a random number in the specified range.

But then I decided I might as well write my own little generator. So I took the algorithm from Generate random numbers in Perl with the rand() function and wrote a few more lines of Perl to go with it, and I've been using that ever since.

But I've noticed something odd: My code almost never generates a number in the middle third of the range. If I ask for a random number between 1 and 360, for example, I get plenty of numbers between 1 and 120, and plenty between 240 and 360, but almost none between 120 and 240.

After I noticed that pattern, I tried generating a bunch of numbers in a row, instead of just generating one when I was ready for a new book. And I got the expected distribution, with about a third of the numbers in the middle of the range. So I decided not to post about it, because it seemed to be working; presumably it had just been a fluke that it had been behaving oddly.

But then the next couple dozen book numbers that I generated were almost all in the first third or the last third of the range.

So the pattern seems to be that when I'm using the generator to actually pick a book, it almost never picks the middle third of the range. But when I'm testing the code, the distribution appears to be pretty much as it should be.

The other day, I picked a book number and it turned up somewhere near the middle of the range, and I thought, Oh, good, it's finally breaking the streak of weird probability distortion. And I went and got the book off the shelf—and discovered that it had been misfiled. The author shown in my list of books was not the actual author. The actual author's last name began with A; if it had been filed correctly, the book would have been in the first few books on the list.

So now I'm thinking that for some reason, my random number generator just doesn't want me to read books by authors with last names starting with F through P. I wonder what secret mysteries are in those books. Maybe there's one that reveals the random-number-generator conspiracy to control the world.

One Response to “Randomly choosing books”

  1. jacob

    Doesn’t seem like a coincidence that the range F through P includes the words

    Federal Reserve
    Lizard People
    Opus Dei

    On the other hand, presumably this means that the Bilderburg Group is in the clear. Whew!


Join the Conversation