Generating a unique string value is a fairly common idiom. I always thought the fastest/easiest way to do so was by merging a timestamp with a random value. Not really unique, but fairly close nevertheless.
Yet, there's better way by using UUID
which provides a more reliable unique identifier. Most languages either have it build in or there's a library available.
For example, in php I could use the build in uniqid()
or in ruby with the help of the uuid gem