summaryrefslogtreecommitdiff
path: root/src/SimpleRandomizer.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-09-28 22:55:05 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-09-28 22:55:05 +0900
commit6f6a17bff75c7a189091bd12265d001450cde704 (patch)
tree3cfdf9d1b62446c2b02bb702140ed13f0775e615 /src/SimpleRandomizer.cc
parent986f69e5bf3caad104bcb20a07ceaaee79182e49 (diff)
Randomizer: Remove unused interfaces
Diffstat (limited to 'src/SimpleRandomizer.cc')
-rw-r--r--src/SimpleRandomizer.cc24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/SimpleRandomizer.cc b/src/SimpleRandomizer.cc
index 89e0ffd1..a75114b9 100644
--- a/src/SimpleRandomizer.cc
+++ b/src/SimpleRandomizer.cc
@@ -78,8 +78,9 @@ SimpleRandomizer::~SimpleRandomizer()
#endif // __MINGW32__
}
-long int SimpleRandomizer::getRandomNumber()
+long int SimpleRandomizer::getRandomNumber(long int to)
{
+ assert(to > 0);
#ifdef __MINGW32__
int32_t val;
BOOL r = CryptGenRandom(cryProvider_, sizeof(val),
@@ -90,26 +91,7 @@ long int SimpleRandomizer::getRandomNumber()
} else if(val < 0) {
val = -val;
}
- return val;
-#else // !__MINGW32__
- return eng_();
-#endif // !__MINGW32__
-}
-
-long int SimpleRandomizer::getMaxRandomNumber()
-{
-#ifdef __MINGW32__
- return INT32_MAX;
-#else // !__MINGW32__
- return eng_.max();
-#endif // !__MINGW32__
-}
-
-long int SimpleRandomizer::getRandomNumber(long int to)
-{
- assert(to > 0);
-#ifdef __MINGW32__
- return getRandomNumber() % to;
+ return val % to;
#else // !__MINGW32__
return std::uniform_int_distribution<long int>(0, to - 1)(eng_);
#endif // !__MINGW32__