title: Setting AUTO_INCREMENT randomly for all new tables in MySQL
body: <p>Is there a way to automatically set AUTO_INCREMENT to a random value whenever a new table is created in MySQL?</p>
  
  <p>Some background: as a developer I regularly work with multiple local installs of Moodle.
  A few times I have been caught out by subtle bugs in my SQL statements where I've mixed up the IDs from two different tables, but this has been masked by both tables having the same numerical value for their ID. e.g. during development, a forum with ID 1 also has a post in it with ID 1, so an SQL statement which muddles-up forum.id and post.id will appear to work locally, but then start giving errors when deployed to the testing server.</p>
  
  <p>If AUTO_INCREMENT always had a random starting point, then such mistakes would be much more likely to be spotted immediately.</p>
  
  <p>Note - for one Moodle install, it would be trivial to tweak the code to set a random AUTO_INCREMENT value whenever I created a new table. Unfortunately, I currently have 30-40 copies of the Moodle codebase for different clients, with new copies being added frequently, so a solution that worked automatically across all my local databases would be very helpful.</p>