From 2f141adb6f3462326b95f93d78f81dbde3d4c8a1 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Thu, 4 Oct 2018 18:05:50 +0200 Subject: [PATCH] Remove random() function --- math/math.cpp | 10 ---------- math/math.h | 1 - tests/mathtests.cpp | 8 -------- 3 files changed, 19 deletions(-) diff --git a/math/math.cpp b/math/math.cpp index 83b8bc5..fa44b0c 100644 --- a/math/math.cpp +++ b/math/math.cpp @@ -11,16 +11,6 @@ namespace MathUtilities { -/*! - * \brief Returns a pseudo random number between \a lowerbounds and \a upperbounds. - * \todo Remove in v5 since std::uniform_int_distribution does the same. - */ -int random(int lowerbounds, int upperbounds) -{ - assert(upperbounds - lowerbounds < RAND_MAX); - return lowerbounds + std::rand() % (upperbounds - lowerbounds + 1); -} - /*! * \brief Returns the digitsum of the given \a number using the specified \a base. * \todo Make constexpr/template in v5. diff --git a/math/math.h b/math/math.h index ec3ddd6..bd9d012 100644 --- a/math/math.h +++ b/math/math.h @@ -6,7 +6,6 @@ namespace MathUtilities { -CPP_UTILITIES_EXPORT int random(int lowerbounds, int upperbounds); CPP_UTILITIES_EXPORT int digitsum(int number, int base = 10); CPP_UTILITIES_EXPORT int factorial(int number); CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module); diff --git a/tests/mathtests.cpp b/tests/mathtests.cpp index b5fbe36..db9b785 100644 --- a/tests/mathtests.cpp +++ b/tests/mathtests.cpp @@ -28,7 +28,6 @@ static_assert(max(3, -2, 4, 2, 1) == 4, "max"); */ class MathTests : public TestFixture { CPPUNIT_TEST_SUITE(MathTests); - CPPUNIT_TEST(testRandom); CPPUNIT_TEST(testDigitsum); CPPUNIT_TEST(testFactorial); CPPUNIT_TEST(testPowerModulo); @@ -44,7 +43,6 @@ public: { } - void testRandom(); void testDigitsum(); void testFactorial(); void testPowerModulo(); @@ -54,12 +52,6 @@ public: CPPUNIT_TEST_SUITE_REGISTRATION(MathTests); -void MathTests::testRandom() -{ -#ifndef PLATFORM_WINDOWS - CPPUNIT_ASSERT_EQUAL(6, random(5, 7)); -#endif -} void MathTests::testDigitsum() {