Generating readable unique IDs for use outside erlang
Dave Challis
dsc@REDACTED
Thu Feb 10 15:34:45 CET 2011
Is there a good (and fast) way of generating a unique id for use outside
Erlang?
The best method I can find for generating a unique id is to use:
{node(), now()}
Which generates something like:
{foo@REDACTED,{1297,347375,276224}}
This works great, and is what I use within erlang.
However, it looks a bit meaningless is likely to confuse users of the
non-erlang application that uses it - is there a nice way to turn that
into an integer, or series of integers instead?
E.g. turning the above into:
3473290872_1297_347375_276224
(or ideally a single integer)
would be fine, but I'm not sure how to get an integer from a term.
Chances are I'll be generating hundreds of thousands to several million
of these, so I'm also a bit concerned about efficiency - turning the
{node(), now()} tuple into a string would no doubt take up more memory
(and some processing time).
Any suggestions on this?
--
Dave Challis
dsc@REDACTED
More information about the erlang-questions
mailing list