[erlang-questions] unique_integer

mickael trouve mickael_trouve@REDACTED
Sat Apr 2 22:32:32 CEST 2016


Hi everyone,
When trying to generate some unique integer I get some strange behavior.I'm currently running on a VM with only one core.

Erlang/OTP 18 [erts-7.3] [source] [64-bit] [async-threads:10] [kernel-poll:false]

Eshell V7.3  (abort with ^G)1> [erlang:unique_integer([positive]) || _ <- lists:seq(1, 15)]. 
[2,4,6,8,10,12,14,16,18,20,22,24,26,28,30]
2> 

Why does the step of the unique integer is 2 ? What about the odd values ?

My second question is about the depth of this integer. I read on the documentation 2⁶⁴ - 1.So i could parse those values in a 64 bits binary integer, right ?
A = erlang:unique_integer([positive]).B = <<A:64/integer>>.

Thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160402/04832b2e/attachment.htm>


More information about the erlang-questions mailing list