Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
19 lines (14 sloc) 0.531 kb
%% @doc Functions for uniquely identifying events.
-module(statebox_identity).
-export([entropy/2, entropy/0]).
-type entropy() :: 1..4294967296.
-export_type([entropy/0]).
%% @equiv entropy(node(), statebox_clock:now())
-spec entropy() -> entropy().
entropy() ->
entropy(node(), statebox_clock:now()).
%% @doc Return an integer that can be expected to be reasonably unique
%% at a given msec timestamp.
-spec entropy(node(), statebox_clock:t_now()) -> entropy().
entropy(Node, Now) ->
erlang:phash2({Node, Now}).
Jump to Line
Something went wrong with that request. Please try again.