1.1 --- a/lemon/random.h Mon Jul 16 16:21:40 2018 +0200
1.2 +++ b/lemon/random.h Wed Oct 17 19:14:07 2018 +0200
1.3 @@ -62,6 +62,8 @@
1.4 #ifndef LEMON_RANDOM_H
1.5 #define LEMON_RANDOM_H
1.6
1.7 +#include <lemon/config.h>
1.8 +
1.9 #include <algorithm>
1.10 #include <iterator>
1.11 #include <vector>
1.12 @@ -71,7 +73,7 @@
1.13 #include <lemon/math.h>
1.14 #include <lemon/dim2.h>
1.15
1.16 -#ifndef WIN32
1.17 +#ifndef LEMON_WIN32
1.18 #include <sys/time.h>
1.19 #include <ctime>
1.20 #include <sys/types.h>
1.21 @@ -199,7 +201,7 @@
1.22
1.23 initState(init);
1.24
1.25 - num = length > end - begin ? length : end - begin;
1.26 + num = static_cast<int>(length > end - begin ? length : end - begin);
1.27 while (num--) {
1.28 curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
1.29 + *it + cnt;
1.30 @@ -213,7 +215,7 @@
1.31 --curr;
1.32 }
1.33
1.34 - num = length - 1; cnt = length - (curr - state) - 1;
1.35 + num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
1.36 while (num--) {
1.37 curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
1.38 - cnt;
1.39 @@ -340,7 +342,7 @@
1.40 do {
1.41 num = rnd() & mask;
1.42 } while (num > max);
1.43 - return num;
1.44 + return static_cast<Result>(num);
1.45 }
1.46 };
1.47
1.48 @@ -605,7 +607,7 @@
1.49 /// it uses the \c seedFromTime().
1.50 /// \return Currently always \c true.
1.51 bool seed() {
1.52 -#ifndef WIN32
1.53 +#ifndef LEMON_WIN32
1.54 if (seedFromFile("/dev/urandom", 0)) return true;
1.55 #endif
1.56 if (seedFromTime()) return true;
1.57 @@ -625,7 +627,7 @@
1.58 /// \param file The source file
1.59 /// \param offset The offset, from the file read.
1.60 /// \return \c true when the seeding successes.
1.61 -#ifndef WIN32
1.62 +#ifndef LEMON_WIN32
1.63 bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0)
1.64 #else
1.65 bool seedFromFile(const std::string& file = "", int offset = 0)
1.66 @@ -647,7 +649,7 @@
1.67 /// random sequence.
1.68 /// \return Currently always \c true.
1.69 bool seedFromTime() {
1.70 -#ifndef WIN32
1.71 +#ifndef LEMON_WIN32
1.72 timeval tv;
1.73 gettimeofday(&tv, 0);
1.74 seed(getpid() + tv.tv_sec + tv.tv_usec);