Good that you found a solution that works for you

I tried this, but the result ended in a code that went up in a predictable sequence.
Your OP post didn't really specify your requirements. But as I mentioned, you can take
any binary data and run it through Base64/Ascii85 to get a valid URL String. Base64/Ascii85 are just efficient encodings from binary to URL-compatible strings. As such they do not try to obfuscate the data in any relevant way. So it is up to you to generate binary data that is obfuscated enough for your uses. Which can be done either by designing your own datatype that stores the data you need in a cryptic way. Or automatically by encrypting or compressing the data.
If you just want to turn a number into another number, you can manually implement something simple like RSA. Here is a short RSA example I wrote in python. It turns any number from 0 to 9795 into another 4-digit number.
def encode(integer):
return str(((integer+2)**17)%9797).rjust(4, '0')
def decode(code):
return (int(code)**3953)%9797-2
For example:
original -> encoded -> decoded
9288 -> 8611 -> 9288
9289 -> 8786 -> 9289
9290 -> 0505 -> 9290
edit: I posted a much faster solution three posts down