nickva commented on a change in pull request #1798: Suppress compiler warnings
URL: https://github.com/apache/couchdb/pull/1798#discussion_r243745920
 
 

 ##########
 File path: src/couch/src/couch_rand.erl
 ##########
 @@ -14,11 +14,34 @@
 
 
 -export([
+    crypto_to_rand/2,
     uniform/0,
     uniform/1
 ]).
 
 
+%% This function takes the Lo and Hi parameters of crypto_rand as input
+%% and calculates the corresponding N value for couch_rand:uniform/1, and
+%% the offset necessary to add to the latter to generate the same range as
+%% crypto:rand/2.
+%%
+%% crypto:rand_uniform(LoInclusive, HiExclusive) generates a random number N
+%% where LoInclusive =< N < HiExclusive [1]
+%%
+%% rand:uniform(HiInclusive) and random:uniform(HiInclusive) both
+%% generate a random number N where 1 =< X =< HiInclusive [2][3].
+%%
+%% [1] http://erlang.org/doc/man/crypto.html#rand_uniform-2
+%% [2] http://erlang.org/doc/man/rand.html#uniform-1
+%% [3] http://erlang.org/doc/man/random.html#uniform-1
+
+crypto_to_rand(LoInclusive, HiExclusive)
 
 Review comment:
   Yeah let's remove if it is not used

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to