The probability of the id not existing should be comparatively small on an average forum, and you could get around that issue easily. Just run the randomly generated id against the database, and if it does not exist, i.e. the result is empty, start over: generate another one, and so on.