[erlang-questions] Generating readable unique IDs for use outside erlang

Olivier Girondel <>
Thu Feb 10 16:02:34 CET 2011


Quite old code, could be rewritten as NIF now:

http://erlang.biniou.org/erluuid






On Thursday, February 10, 2011, Dave Challis <> wrote:
> 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:
> {,{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
> 
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
>
>

-- 
Olivier


More information about the erlang-questions mailing list