mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Improve comment at Andrea's request
This commit is contained in:
parent
e998bbcdd5
commit
69ab7cd828
@ -5010,8 +5010,10 @@ tor_init_weak_random(tor_weak_rng_t *rng, unsigned seed)
|
|||||||
int32_t
|
int32_t
|
||||||
tor_weak_random(tor_weak_rng_t *rng)
|
tor_weak_random(tor_weak_rng_t *rng)
|
||||||
{
|
{
|
||||||
/* Here's a linear congruential generator. OpenBSD and glibc use it. We
|
/* Here's a linear congruential generator. OpenBSD and glibc use these
|
||||||
* don't want to use windows's rand(), because that returns values in the
|
* 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. */
|
* range 0..INT16_MAX, which just isn't enough. */
|
||||||
rng->state = (rng->state * 1103515245 + 12345) & 0x7fffffff;
|
rng->state = (rng->state * 1103515245 + 12345) & 0x7fffffff;
|
||||||
return (int32_t) rng->state;
|
return (int32_t) rng->state;
|
||||||
|
Loading…
Reference in New Issue
Block a user