I just got done reading this about how to correctly use rand() and time(). I notice that I compiler warnings about converting to int from double.
So to resolve the warnings I've explicitly cast my return statement in these functions:
Is this the correct way to cast the returns or should i use <static_cast>? Or is there another more correct solution?Code:int get_rand( int UPPER_BOUND ){ return (int)( uniform_deviate( rand() ) * UPPER_BOUND ); } int get_rand( int LOWER_BOUND, int UPPER_BOUND ){ return (int)( LOWER_BOUND + uniform_deviate( rand() ) * ( UPPER_BOUND - LOWER_BOUND ) ); }