summaryrefslogtreecommitdiff
path: root/src/SimpleRandomizer.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:12:52 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2016-03-26 17:20:27 +0900
commitd64089632e82a2548752c7a6baaa68365a795a74 (patch)
tree57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/SimpleRandomizer.h
parentc81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff)
parenta7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff)
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/SimpleRandomizer.h')
-rw-r--r--src/SimpleRandomizer.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/SimpleRandomizer.h b/src/SimpleRandomizer.h
index b3896ebd..7440dd36 100644
--- a/src/SimpleRandomizer.h
+++ b/src/SimpleRandomizer.h
@@ -41,7 +41,7 @@
#include <random>
#ifdef __MINGW32__
-# include <wincrypt.h>
+#include <wincrypt.h>
#endif
namespace aria2 {
@@ -55,11 +55,11 @@ private:
#ifdef __MINGW32__
HCRYPTPROV provider_;
#else
- std::random_device dev_;
+ std::mt19937 gen_;
#endif // ! __MINGW32__
public:
- typedef std::random_device::result_type result_type;
+ typedef std::mt19937::result_type result_type;
static const std::unique_ptr<SimpleRandomizer>& getInstance();
@@ -70,12 +70,9 @@ public:
*/
virtual long int getRandomNumber(long int to) CXX11_OVERRIDE;
- void getRandomBytes(unsigned char *buf, size_t len);
+ void getRandomBytes(unsigned char* buf, size_t len);
- long int operator()(long int to)
- {
- return getRandomNumber(to);
- }
+ long int operator()(long int to) { return getRandomNumber(to); }
result_type operator()()
{
@@ -94,10 +91,7 @@ public:
return std::numeric_limits<result_type>::max();
}
- static double entropy()
- {
- return 0.0;
- }
+ static double entropy() { return 0.0; }
};
} // namespace aria2