Random Numbers Part 1: Modulus and Primes
I’ve wondered a few times how we might generate a one-to-one mapping between a range of integers, and a “shuffled” counterpart in that range. For example, imagine a website where we expose primary keys as part of the URL path:
http://www.example.com/pageId=123
This invites someone to try plugging in different pageId values into the URL, as it would be a fair guess that it just represents a database sequence. A scraper could enumerate all pages on the website by incrementing pageId by 1 on each request.