Remove random() function

This commit is contained in:
Marius Kittler 2018-10-04 18:05:50 +02:00 committed by Martchus
parent 73ddc55702
commit 2f141adb6f
3 changed files with 0 additions and 19 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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()
{