randomUtils.cpp

Go to the documentation of this file.
00001 
00011 #include "randomUtils.h"
00012 
00013 double randomUtils::randomDouble() {
00014         return ((double)rand()) / ((double)RAND_MAX + 1);
00015 }
00016 
00017 int randomUtils::randomInt( const int x, const int y ) {
00018         if ( x > y )
00019                 return ( ( int ) ( randomDouble() * ( x - y ) ) ) + y;
00020         else
00021                 return ( ( int ) ( randomDouble() * ( y - x ) ) ) + x;
00022 }
00023 
00024 unsigned int randomUtils::randomInt( const unsigned int x, const unsigned int y ) {
00025         if ( x > y )
00026                 return ( ( unsigned int ) ( randomDouble() * ( x - y ) ) ) + y;
00027         else
00028                 return ( ( unsigned int ) ( randomDouble() * ( y - x ) ) ) + x;
00029 }

Generated on Sat Oct 13 17:34:42 2007 for R-Tree by  doxygen 1.5.2