summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-02-08 17:13:11 -0500
committerNick Mathewson <nickm@torproject.org>2013-02-08 17:13:11 -0500
commit69ab7cd8281dcb312eb47b738d1c620e7bc042d9 (patch)
tree5d26f22ff7f331c1bab1a9936b8dc0b3257bba1e /src/common
parente998bbcdd5fbfda68f61468541d75bb4a36552bf (diff)
downloadtor-69ab7cd8281dcb312eb47b738d1c620e7bc042d9.tar.gz
tor-69ab7cd8281dcb312eb47b738d1c620e7bc042d9.zip
Improve comment at Andrea's request
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 03840402b7..49353a8ee1 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -5010,8 +5010,10 @@ tor_init_weak_random(tor_weak_rng_t *rng, unsigned seed)
int32_t
tor_weak_random(tor_weak_rng_t *rng)
{
- /* Here's a linear congruential generator. OpenBSD and glibc use it. We
- * don't want to use windows's rand(), because that returns values in the
+ /* Here's a linear congruential generator. OpenBSD and glibc use these
+ * parameters; they aren't too bad, and should have maximal period over the
+ * range 0..INT32_MAX. We don't want to use the platform rand() or random(),
+ * since some platforms have bad weak RNGs that only return values in the
* range 0..INT16_MAX, which just isn't enough. */
rng->state = (rng->state * 1103515245 + 12345) & 0x7fffffff;
return (int32_t) rng->state;