Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:19
cpg
0001-replace-quickrand-to-rand.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-replace-quickrand-to-rand.patch of Package cpg
From f41634215f2a92bf91b29bfe9beb9484084d423a Mon Sep 17 00:00:00 2001 From: Led <ledest@gmail.com> Date: Mon, 29 Oct 2018 13:56:15 +0200 Subject: [PATCH 01/15] replace quickrand to rand --- mix.exs | 7 ++----- rebar.config | 3 --- src/cpg.app.src | 1 - src/cpg.erl | 9 +-------- src/cpg_data.erl | 10 ++-------- 5 files changed, 5 insertions(+), 25 deletions(-) diff --git a/mix.exs b/mix.exs index a059a91..bd8fda7 100644 --- a/mix.exs +++ b/mix.exs @@ -30,9 +30,7 @@ defmodule CPG.Mixfile do end def application do - [applications: [ - :quickrand, - :trie], + [applications: [:trie], mod: {:cpg_app, []}, registered: [ :cpg_default_scope, @@ -49,8 +47,7 @@ defmodule CPG.Mixfile do defp deps do [{:trie, ">= 1.8.0"}, - {:reltool_util, ">= 1.8.0"}, - {:quickrand, ">= 1.8.0"}] + {:reltool_util, ">= 1.8.0"}] end defp description do diff --git a/rebar.config b/rebar.config index e88b115..fb1e749 100644 --- a/rebar.config +++ b/rebar.config @@ -7,9 +7,6 @@ {tag, "v1.8.0"}}}, {reltool_util, ".*", {git, "https://github.com/okeuday/reltool_util.git", - {tag, "v1.8.0"}}}, - {quickrand, ".*", - {git, "https://github.com/okeuday/quickrand.git", {tag, "v1.8.0"}}}]}. {erl_opts, diff --git a/src/cpg.app.src b/src/cpg.app.src index 66948ae..c736bb0 100644 --- a/src/cpg.app.src +++ b/src/cpg.app.src @@ -22,7 +22,6 @@ groups_scope2 ]}, {applications, [ - quickrand, trie, stdlib, kernel diff --git a/src/cpg.erl b/src/cpg.erl index 0159a6f..b337b97 100644 --- a/src/cpg.erl +++ b/src/cpg.erl @@ -2666,7 +2666,6 @@ init([Scope]) -> Listen = cpg_app:listen_type(), ok = monitor_nodes(true, Listen), ok = gather_groups(listen_nodes(Listen), Scope), - ok = quickrand:seed(), {ok, #state{scope = Scope, groups = cpg_data:get_empty_groups(), listen = Listen}}. @@ -3739,7 +3738,7 @@ monitor_remote(Pid, PidNode, GroupName, MonitorsOld, NodeMonitorsOld) -> whereis_name_random(1, [Pid]) -> Pid; whereis_name_random(N, L) -> - lists:nth(random(N), L). + lists:nth(rand:uniform(N), L). count(Elem, List) -> count(List, 0, Elem). @@ -3761,9 +3760,3 @@ delete_all(Elem, [Elem | T]) -> delete_all(Elem, T); delete_all(Elem, [H | T]) -> [H | delete_all(Elem, T)]. - --compile({inline, [{random,1}]}). - -random(N) -> - quickrand:uniform(N). - diff --git a/src/cpg_data.erl b/src/cpg_data.erl index aa44d57..a45575e 100644 --- a/src/cpg_data.erl +++ b/src/cpg_data.erl @@ -915,7 +915,7 @@ pick(1, [Pid], Pattern) -> {ok, Pattern, Pid}; pick(N, L, Pattern) -> - Pid = lists:nth(random(N), L), + Pid = lists:nth(rand:uniform(N), L), {ok, Pattern, Pid}. pick_i(I, I, _, [], [], _, GroupName, _) -> @@ -947,7 +947,7 @@ pick(0, [], _, GroupName, _) -> {error, {'no_process', GroupName}}; pick(N, L, Exclude, GroupName, Pattern) -> - pick_i(1, random(N), 0, [], L, Exclude, GroupName, Pattern). + pick_i(1, rand:uniform(N), 0, [], L, Exclude, GroupName, Pattern). pick(0, [], N2, L2, Exclude, GroupName, Pattern) -> pick(N2, L2, Exclude, GroupName, Pattern); @@ -1080,9 +1080,3 @@ history_remote_newest_pid([_ | History], Exclude, Node, GroupName, Pattern) -> history_remote_newest_pid(History, Exclude, Node, GroupName, Pattern). history_remote_newest([_ | _] = History, Exclude, GroupName, Pattern) -> history_remote_newest_pid(History, Exclude, node(), GroupName, Pattern). - --compile({inline, [{random,1}]}). - -random(N) -> - quickrand:uniform(N). - -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor