Remove random() function
This commit is contained in:
parent
73ddc55702
commit
2f141adb6f
|
@ -11,16 +11,6 @@
|
||||||
|
|
||||||
namespace MathUtilities {
|
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.
|
* \brief Returns the digitsum of the given \a number using the specified \a base.
|
||||||
* \todo Make constexpr/template in v5.
|
* \todo Make constexpr/template in v5.
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
namespace MathUtilities {
|
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 digitsum(int number, int base = 10);
|
||||||
CPP_UTILITIES_EXPORT int factorial(int number);
|
CPP_UTILITIES_EXPORT int factorial(int number);
|
||||||
CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module);
|
CPP_UTILITIES_EXPORT uint64 powerModulo(uint64 base, uint64 expontent, uint64 module);
|
||||||
|
|
|
@ -28,7 +28,6 @@ static_assert(max(3, -2, 4, 2, 1) == 4, "max");
|
||||||
*/
|
*/
|
||||||
class MathTests : public TestFixture {
|
class MathTests : public TestFixture {
|
||||||
CPPUNIT_TEST_SUITE(MathTests);
|
CPPUNIT_TEST_SUITE(MathTests);
|
||||||
CPPUNIT_TEST(testRandom);
|
|
||||||
CPPUNIT_TEST(testDigitsum);
|
CPPUNIT_TEST(testDigitsum);
|
||||||
CPPUNIT_TEST(testFactorial);
|
CPPUNIT_TEST(testFactorial);
|
||||||
CPPUNIT_TEST(testPowerModulo);
|
CPPUNIT_TEST(testPowerModulo);
|
||||||
|
@ -44,7 +43,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void testRandom();
|
|
||||||
void testDigitsum();
|
void testDigitsum();
|
||||||
void testFactorial();
|
void testFactorial();
|
||||||
void testPowerModulo();
|
void testPowerModulo();
|
||||||
|
@ -54,12 +52,6 @@ public:
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(MathTests);
|
CPPUNIT_TEST_SUITE_REGISTRATION(MathTests);
|
||||||
|
|
||||||
void MathTests::testRandom()
|
|
||||||
{
|
|
||||||
#ifndef PLATFORM_WINDOWS
|
|
||||||
CPPUNIT_ASSERT_EQUAL(6, random(5, 7));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void MathTests::testDigitsum()
|
void MathTests::testDigitsum()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue