[erlang-questions] erlang:phash2(make_ref(), 1 bsl 32)
Thu May 8 16:30:26 CEST 2008
> I thought that would be the easiest way to generate an integer
> unique enough for my needs. But it seems to always repeat in 2^18
> (262144) iterations.
> That is because #Ref<_._.X.Y> gives the same phash2 as
> #Ref<_._.X+1.Y> in any range between 2^20 and 2^32.
Once upon a time references were 18 bits wide, but there is no reason
why a hash function should not hash all bits. It's probably a
I've added a comment to the source code. Thanks for pointing it out.
Hans Bolinder, Erlang/OTP, Ericsson
More information about the erlang-questions