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

 ##########
 File path: src/mem3/src/mem3.erl
 ##########
 @@ -196,7 +196,7 @@ choose_shards(DbName, Nodes, Options) ->
     Q = mem3_util:q_val(couch_util:get_value(q, Options,
         config:get("cluster", "q", "8"))),
     %% rotate to a random entry in the nodelist for even distribution
-    {A, B} = lists:split(crypto:rand_uniform(1,length(Nodes)+1), Nodes),
+    {A, B} = lists:split(couch_rand:uniform(length(Nodes)+1), Nodes),
 
 Review comment:
   ```
   ([email protected])2> couch_rand:uniform(2).
   2
   ([email protected])3> couch_rand:uniform(2).
   2
   ([email protected])4> couch_rand:uniform(2).
   1
   ([email protected])5> couch_rand:uniform(2).
   1
   ([email protected])6> couch_rand:uniform(2).
   1
   
   ([email protected])7> crypto:rand_uniform(1,2).
   1
   ([email protected])8> crypto:rand_uniform(1,2).
   1
   ([email protected])9> crypto:rand_uniform(1,2).
   1
   ([email protected])10> crypto:rand_uniform(1,2).
   1
   ([email protected])11> crypto:rand_uniform(1,2).
   1
   ([email protected])12> crypto:rand_uniform(1,2).
   1
   ```
   whoa that is sneaky as heck, and will hopefully teach me to not make 
assumptions about the uniformity of word meaning. Thank you for pointing out 
what would have been a horrific bug.

----------------------------------------------------------------
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