Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2016-01-04 13:55:25 +0300
committerAlexey Shchepin <alexey@process-one.net>2016-01-04 13:59:37 +0300
commitfb8a51136519a190145265736c4243095e2516ec (patch)
tree0a7ac88a19ecb9deb08406dff45d426d10e7431b /src
parent94c620cc2780fe8efa1650b732149f620c4397dd (diff)
Use crypto:rand_uniform instead of random:uniform
Diffstat (limited to 'src')
-rw-r--r--src/randoms.erl21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/randoms.erl b/src/randoms.erl
index 4068fa79d..9d9b392f6 100644
--- a/src/randoms.erl
+++ b/src/randoms.erl
@@ -29,23 +29,12 @@
-export([get_string/0]).
--export([start/0, init/0]).
+-export([start/0]).
start() ->
- register(random_generator, spawn(randoms, init, [])).
-
-init() ->
- random:seed(p1_time_compat:timestamp()), loop().
-
-loop() ->
- receive
- {From, get_random, N} ->
- From ! {random, random:uniform(N)}, loop();
- _ -> loop()
- end.
+ ok.
get_string() ->
- random_generator ! {self(), get_random, 65536 * 65536},
- receive
- {random, R} -> jlib:integer_to_binary(R)
- end.
+ R = crypto:rand_uniform(0, 16#10000000000000000),
+ jlib:integer_to_binary(R).
+