diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index cc4219e501..4497e22b8d 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -12,6 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include #include #include #include @@ -220,7 +221,7 @@ void Dhcpv6Srv::setServerID() { // Length of the identifier is company specific. I hereby declare // ISC "standard" of 6 bytes long pseudo-random numbers. - srand(time(NULL)); + srandom(time(NULL)); fillRandom(&srvid[6],&srvid[12]); serverid_ = OptionPtr(new Option(Option::V6, D6O_SERVERID, diff --git a/src/lib/util/range_utilities.h b/src/lib/util/range_utilities.h index 3ba2cb5b0e..3f8b971b2d 100644 --- a/src/lib/util/range_utilities.h +++ b/src/lib/util/range_utilities.h @@ -15,7 +15,7 @@ #ifndef __RANGE_UTIL_H_ #define __RANGE_UTIL_H_ 1 -#include +#include #include // This header contains useful methods for conduction operations on @@ -58,7 +58,7 @@ template void fillRandom(Iterator begin, Iterator end) { for (Iterator x = begin; x != end; ++x) { - *x = std::rand(); + *x = random(); } } diff --git a/src/lib/util/tests/range_utilities_unittest.cc b/src/lib/util/tests/range_utilities_unittest.cc index 31f9f2149e..6fa1c6472f 100644 --- a/src/lib/util/tests/range_utilities_unittest.cc +++ b/src/lib/util/tests/range_utilities_unittest.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -38,6 +39,8 @@ TEST(RangeUtilitiesTest, isZero) { TEST(RangeUtilitiesTest, randomFill) { + srandom(time(NULL)); + vector vec1(16,0); vector vec2(16,0);