This is a comment on "Advanced Database Programming with Python"
For example in MySQL, the index is implemented as a balanced tree. Quite obvious. If your are inserting a new entry with a random number, the tree may have to be rebalanced again. Now imagine, you are running a master node with several hundreds of slave nodes, each one of it has to rebalance its index. Maybe there are some usecases, where random ID actually makes sense. But most of the times they result in hard to debug problems on a large scale environment.
Again in MySQL, they assume, you will need the recently inserted entry in short time again. They get this entry because of its location in the balanced tree. So, with random IDs, you break this mechanism as well.
However. All this stuff depends on the DBMS you are using, but auto_increment is a well known and well tested feature within decades. Do not try to solve problems that do not exist ;)