]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Document crypto_fast_rng_one_in_n.
authorNick Mathewson <nickm@torproject.org>
Fri, 1 Mar 2019 13:20:54 +0000 (08:20 -0500)
committerNick Mathewson <nickm@torproject.org>
Fri, 1 Mar 2019 13:20:54 +0000 (08:20 -0500)
src/lib/crypt_ops/crypto_rand.h

index bb424fd69113929038dae4097d633dcf590d3555..6f09aedf6a273b95068b5fdf5e508af8bba03977 100644 (file)
@@ -68,6 +68,12 @@ unsigned crypto_fast_rng_get_uint(crypto_fast_rng_t *rng, unsigned limit);
 uint64_t crypto_fast_rng_get_uint64(crypto_fast_rng_t *rng, uint64_t limit);
 double crypto_fast_rng_get_double(crypto_fast_rng_t *rng);
 
+/**
+ * Using the fast_rng <b>rng</b>, yield true with probability
+ * 1/<b>n</b>. Otherwise yield false.
+ *
+ * <b>n</b> must not be zero.
+ **/
 #define crypto_fast_rng_one_in_n(rng, n)        \
   (0 == (crypto_fast_rng_get_uint((rng), (n))))