test: fix incorrect use of RAND_MAX
On some systems (e.g. Solaris/OpenIndiana) rand() and random() have different ranges. RAND_MAX is the maximum value returned by rand(), but random() should always have a range of 0 through 2^31-1. This fixes multiple failures in different tests.
This commit is contained in:
parent
5e6f8458ff
commit
9600993c28
1 changed files with 1 additions and 1 deletions
|
@ -90,7 +90,7 @@ main(int argc, char **argv)
|
|||
double
|
||||
TST_GetRandomDouble(double min, double max)
|
||||
{
|
||||
return min + (double)random() / RAND_MAX * (max - min);
|
||||
return min + random() / 2147483647.0 * (max - min);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue