ret_chk = rand();
TC_ASSERT_GEQ("rand", ret_chk, 0);
- TC_ASSERT_LT("rand", ret_chk, MAX_RAND);
+ TC_ASSERT_LT("rand", ret_chk, RAND_MAX);
ret_chk = rand();
TC_ASSERT_GEQ("rand", ret_chk, 0);
- TC_ASSERT_LT("rand", ret_chk, MAX_RAND);
+ TC_ASSERT_LT("rand", ret_chk, RAND_MAX);
ret_chk = rand();
TC_ASSERT_GEQ("rand", ret_chk, 0);
- TC_ASSERT_LT("rand", ret_chk, MAX_RAND);
+ TC_ASSERT_LT("rand", ret_chk, RAND_MAX);
TC_SUCCESS_RESULT();
}
}
unsigned short random_rand(void)
{
- /* In gcc int rand() uses MAX_RAND and long random() uses RANDOM_MAX=0x7FFFFFFF */
- /* MAX_RAND varies depending on the architecture */
+ /* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX=0x7FFFFFFF */
+ /* RAND_MAX varies depending on the architecture */
return (unsigned short)rand();
}
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
-/* In gcc int rand() uses MAX_RAND and long random() uses RANDOM_MAX */
+/* In gcc int rand() uses RAND_MAX and long random() uses RANDOM_MAX */
/* Since random_rand casts to unsigned short, we'll use this maxmimum */
#define RANDOM_RAND_MAX 65535U
/* Maximum value returned by rand() */
-#define MAX_RAND 32767
+#define RAND_MAX 32767
/* Integer expression whose value is the maximum number of bytes in a
* character specified by the current locale.