Well, if by any chance you are using Apache as your webserver, you could always use the
module, which will happily generate unique numbers for you.
If you choose to make use of Apache::Session for this purpose, you would always have the option down the road to make use of the session support it provides -- allowing you to store data in the server across requests. Good luck!