diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-13 13:26:27 -0400 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-13 13:26:27 -0400 |
| commit | 3e49337d9a773a5d805a908bc093b5d72985d8d9 (patch) | |
| tree | dd8bf524287442c1c3a30f9390d712b77c0e53d0 /node/Demarc.cpp | |
| parent | c6dd5b239ff30a192c5bc6e784fd5d4b3085646d (diff) | |
| download | infinitytier-3e49337d9a773a5d805a908bc093b5d72985d8d9.tar.gz infinitytier-3e49337d9a773a5d805a908bc093b5d72985d8d9.zip | |
Add a fast non-cryptographic PRNG.
Diffstat (limited to 'node/Demarc.cpp')
| -rw-r--r-- | node/Demarc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/node/Demarc.cpp b/node/Demarc.cpp index 4885c086..cf521707 100644 --- a/node/Demarc.cpp +++ b/node/Demarc.cpp @@ -143,7 +143,7 @@ Demarc::Port Demarc::pick(const InetAddress &to) const } } if (possibilities.size()) - return possibilities[Utils::randomInt<unsigned int>() % possibilities.size()]->first; + return possibilities[_r->prng.next32() % possibilities.size()]->first; else return NULL_PORT; } catch ( ... ) { return NULL_PORT; @@ -174,7 +174,7 @@ Demarc::Port Demarc::send(Demarc::Port fromPort,const InetAddress &to,const void } } if (possibilities.size()) - pe = possibilities[Utils::randomInt<unsigned int>() % possibilities.size()]; + pe = possibilities[_r->prng.next32() % possibilities.size()]; else { _ports_m.unlock(); return NULL_PORT; |
