Skip to content

Commit

Permalink
Use rand directly in master because we require Erlang 18.3
Browse files Browse the repository at this point in the history
References #860.
[#122335241]
  • Loading branch information
dumbbell committed Jun 29, 2016
1 parent fbad57d commit f0f43f8
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/file_handle_cache.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ notify_age(CStates, AverageAge) ->
notify_age0(Clients, CStates, Required) ->
case [CState || CState <- CStates, CState#cstate.callback =/= undefined] of
[] -> ok;
Notifications -> S = rand_compat:uniform(length(Notifications)),
Notifications -> S = rand:uniform(length(Notifications)),
{L1, L2} = lists:split(S, Notifications),
notify(Clients, Required, L2 ++ L1)
end.
Expand Down
2 changes: 1 addition & 1 deletion src/gm.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ join_group(Self, GroupName, #gm_group { members = Members } = Group, TxnFun) ->
prune_or_create_group(Self, GroupName, TxnFun),
TxnFun);
Alive ->
Left = lists:nth(rand_compat:uniform(length(Alive)), Alive),
Left = lists:nth(rand:uniform(length(Alive)), Alive),
Handler =
fun () ->
join_group(
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_cli.erl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ main(ParseFun, DoFun, UsageMod) ->
start_distribution_anon(0, LastError) ->
{error, LastError};
start_distribution_anon(TriesLeft, _) ->
NameCandidate = list_to_atom(rabbit_misc:format("rabbitmq-cli-~2..0b", [rand_compat:uniform(100)])),
NameCandidate = list_to_atom(rabbit_misc:format("rabbitmq-cli-~2..0b", [rand:uniform(100)])),
case net_kernel:start([NameCandidate, name_type()]) of
{ok, _} = Result ->
Result;
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_limiter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ notify_queues(State = #lim{ch_pid = ChPid, queues = Queues}) ->
%% We randomly vary the position of queues in the list,
%% thus ensuring that each queue has an equal chance of
%% being notified first.
{L1, L2} = lists:split(rand_compat:uniform(L), QList),
{L1, L2} = lists:split(rand:uniform(L), QList),
[[ok = rabbit_amqqueue:resume(Q, ChPid) || Q <- L3]
|| L3 <- [L2, L1]],
ok
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_mirror_queue_mode_exactly.erl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ suggested_queue_nodes(Count, MNode, SNodes, _SSNodes, Poss) ->
end}.

shuffle(L) ->
{_, L1} = lists:unzip(lists:keysort(1, [{rand_compat:uniform(), N} || N <- L])),
{_, L1} = lists:unzip(lists:keysort(1, [{rand:uniform(), N} || N <- L])),
L1.

validate_policy(N) when is_integer(N) andalso N > 0 ->
Expand Down
2 changes: 1 addition & 1 deletion src/rabbit_password.erl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ hash(HashingMod, Cleartext) ->
<<SaltBin/binary, Hash/binary>>.

generate_salt() ->
Salt = rand_compat:uniform(16#ffffffff),
Salt = rand:uniform(16#ffffffff),
<<Salt:32>>.

salted_hash(Salt, Cleartext) ->
Expand Down

0 comments on commit f0f43f8

Please sign in to comment.