소스 검색

Document crypto_fast_rng_one_in_n.

Nick Mathewson 6 년 전
부모
커밋
64f594499a
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/lib/crypt_ops/crypto_rand.h

+ 6 - 0
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))))