Fun with Erlang (was Re: Stand Alone Erlang for Windows. yet again)
Ulf Wiger
etxuwig@REDACTED
Sat Mar 17 12:04:28 CET 2001
On Sat, 17 Mar 2001, Ulf Wiger wrote:
>I tend to prefer to generate a globally unique ID whenever I need a
>reference. The scheme I prefer is
>
> ID = {node(), erlang:now()}.
>
>It's fast, and under most realistic circumstances (even persistently)
>unique with very high probability.
It's actually also quite easy to produce a nice external ID this way:
(mud@REDACTED)2> F=fun() -> N=node(),{MS,S,US} = erlang:now(),
atom_to_list(N) ++ "." ++ integer_to_list(MS) ++ "." ++
integer_to_list(S) ++ "." ++ integer_to_list(US) end.
#Fun<erl_eval.20.95849314>
(mud@REDACTED)3> F().
"mud@REDACTED"
(mud@REDACTED)4> F().
"mud@REDACTED"
(mud@REDACTED)5>
/Uffe
--
Ulf Wiger tfn: +46 8 719 81 95
Senior System Architect mob: +46 70 519 81 95
Strategic Product & System Management ATM Multiservice Networks
Data Backbone & Optical Services Division Ericsson Telecom AB
More information about the erlang-questions
mailing list