Can you give us more information, is it a web application, are you using session variables, are you running this on *nix, Windows etc etc
Depending on your situation, there are a number of variables you can use to create faceted codes,(time, process id, session key(random)) which could then be passed to a function to create a totally random id.
What's your need for randomness?
--paul
cigless ...