Lock-free HashRandomStream
Created by: carabolic
The current reference implementation of the Random Hash function is not thread safe. In order to support intra-node parallelism a lock-free implementation is favourable.
The problem could occur when two concurrent threads are calling HashRandomStream#nextLong()
at the same time. It is possible (and not unlikely) that both calls intervene each other and overwrite each other.
Using AtomicLong
instead of long
should fix this issue.