you are viewing a single comment's thread
view the rest of the comments
[–] 26 points 2 years ago (1 child)

Really enjoyed the read. Thanks for sharing. I’m surprised by the random page implementation.

Usually in a database each record has an integer primary key. The keys would be assigned sequentially as pages are created. Then the “random page” function could select a random integer between zero and the largest page index. If that index isn’t used (because the page was deleted), you could either try again with a new random number or then march up to the next non empty index.

  • source
  • hideshow 2 child comments
  • [–] 27 points 2 years ago (1 child)

    Marching up to the next non-empty key would skew the distribution—pages preceded by more empty keys would show up more often under “random”.

  • source
  • parent
  • hideshow 2 child comments