13#ifndef USEFULSTUFF_HPP_
14#define USEFULSTUFF_HPP_
34 double const secondDouble,
35 double maximumDifference );
40 double const upperLimit );
70 double const secondDouble,
71 double maximumDifference )
75 return ( abs( maximumDifference ) >= abs( firstDouble - secondDouble ) );
80 double const upperLimit )
87 return ( lowerLimit + ( (
double)(rand()) / (
double)RAND_MAX )
88 * ( upperLimit - lowerLimit ) );
96 return ( (rand()) % 2 );
123 srand( time( NULL ) );
132 std::ifstream fileStream( fileName.c_str() );
133 if( fileStream.good() )
147 int systemReturn( system( systemCommand.c_str() ) );
148 if( -1 == systemReturn )
150 throw std::runtime_error(
"system( \"" + systemCommand
151 +
"\" ) returned -1" );
static void ensureRandomSeedIsSet()
static bool doublesCloseEnough(double const firstDouble, double const secondDouble, double maximumDifference)
static double const twicePi
static int plusOrMinusOne()
static bool fileExists(std::string const &fileName)
static bool randomSeedNotYetSet
static void runSystemCommand(std::string const &systemCommand)
static double flatRandomDouble(double const lowerLimit, double const upperLimit)
static double const notANumber
static std::string const nanString