Coding of unsigned int to prevent guessing next ID Suppose we are assigning records an unsigned integer ID from a N-bit space (say 32-bit) in a sequential manner. Is there a way we can code this ID before showing it to the public such that someone can't guess the next ID in the sequence. It should be two-way, such that given the coded int, we can determine the original ID and 1:1 such that every ID has exactly one corresponding coded int (ideally of the same bit-length).

This doesn't need to hold up to any kind of brute force attack, but should be non-obvious to viewers if two coded integers represent IDs close together or far apart.

Any ideas? The simpler the implementation the better.
swap-or-not seems perfect for your use case.