diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-03-01 08:20:54 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-03-01 08:20:54 -0500 |
commit | 64f594499a3e8893a6097fa5db7d47962f83d2f5 (patch) | |
tree | 5406a369b23a594def8dc6e88c310ff7ab56c494 /src/lib | |
parent | b3416476b487304426296173dd177e1277388e48 (diff) | |
download | tor-64f594499a3e8893a6097fa5db7d47962f83d2f5.tar.gz tor-64f594499a3e8893a6097fa5db7d47962f83d2f5.zip |
Document crypto_fast_rng_one_in_n.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/crypt_ops/crypto_rand.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/crypt_ops/crypto_rand.h b/src/lib/crypt_ops/crypto_rand.h index bb424fd691..6f09aedf6a 100644 --- a/src/lib/crypt_ops/crypto_rand.h +++ b/src/lib/crypt_ops/crypto_rand.h @@ -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)))) |