Skip to content

Commit abd33bc

Browse files
try using srand instead of srand48
the 48-bit versions are only available on linux(-like?) machines. Was causing the windows failure.
1 parent 6cb51e8 commit abd33bc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/test_fmm_source.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ void Y(test_fmm)(size_t N, size_t maxs, size_t M, FLT m, size_t random, size_t l
88
FLT *input_array = (FLT *)calloc(N, sizeof(FLT));
99
FLT *output_array = (FLT *)calloc(N, sizeof(FLT));
1010

11-
// srand48((unsigned int)time(NULL));
12-
srand48(1);
11+
// srand((unsigned) time(&t));
12+
srand(1);
1313
// Initialize some input array
1414
if (random == 1)
1515
{
1616
for (size_t i = 0; i < N; i++)
17-
input_array[i] = (2 * drand48() - 1) / pow(i + 1, m);
17+
input_array[i] = (2.0*(((double) rand())/RAND_MAX)-1.0) / pow(i + 1, m);
1818
}
1919
else
2020
{
@@ -117,12 +117,12 @@ void Y(test_fmm_transforms)(int *checksum, int N)
117117
FLT *input_array = (FLT *)calloc(n, sizeof(FLT));
118118
FLT *output_array = (FLT *)calloc(n, sizeof(FLT));
119119
FLT *ia = (FLT *)calloc(n, sizeof(FLT));
120-
srand48(1);
120+
srand(1);
121121
FLT e0 = 0;
122122
for (int i = 0; i < n; i++)
123123
{
124124
// input_array[i] = 1;
125-
input_array[i] = (2 * drand48() - 1) / pow(i + 1, m);
125+
input_array[i] = (2.0*(((double) rand())/RAND_MAX)-1.0) / pow(i + 1, m);
126126
e0 = MAX(e0, Y(fabs)(input_array[i]));
127127
}
128128

@@ -174,4 +174,4 @@ void Y(test_fmm_transforms2d)(int *checksum, int N)
174174
free(output_array);
175175
free(ia);
176176
}
177-
}
177+
}

0 commit comments

Comments
 (0)