From abd33bc1e99f9e75cff7ade1154ecc2f4cec6a62 Mon Sep 17 00:00:00 2001 From: MikaelSlevinsky Date: Wed, 15 May 2024 12:43:10 -0500 Subject: [PATCH] try using srand instead of srand48 the 48-bit versions are only available on linux(-like?) machines. Was causing the windows failure. --- test/test_fmm_source.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_fmm_source.c b/test/test_fmm_source.c index 6cbf85c..faa1a31 100644 --- a/test/test_fmm_source.c +++ b/test/test_fmm_source.c @@ -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 FLT *input_array = (FLT *)calloc(N, sizeof(FLT)); FLT *output_array = (FLT *)calloc(N, sizeof(FLT)); - // srand48((unsigned int)time(NULL)); - srand48(1); + // srand((unsigned) time(&t)); + srand(1); // Initialize some input array if (random == 1) { for (size_t i = 0; i < N; i++) - input_array[i] = (2 * drand48() - 1) / pow(i + 1, m); + input_array[i] = (2.0*(((double) rand())/RAND_MAX)-1.0) / pow(i + 1, m); } else { @@ -117,12 +117,12 @@ void Y(test_fmm_transforms)(int *checksum, int N) FLT *input_array = (FLT *)calloc(n, sizeof(FLT)); FLT *output_array = (FLT *)calloc(n, sizeof(FLT)); FLT *ia = (FLT *)calloc(n, sizeof(FLT)); - srand48(1); + srand(1); FLT e0 = 0; for (int i = 0; i < n; i++) { // input_array[i] = 1; - input_array[i] = (2 * drand48() - 1) / pow(i + 1, m); + input_array[i] = (2.0*(((double) rand())/RAND_MAX)-1.0) / pow(i + 1, m); e0 = MAX(e0, Y(fabs)(input_array[i])); } @@ -174,4 +174,4 @@ void Y(test_fmm_transforms2d)(int *checksum, int N) free(output_array); free(ia); } -} \ No newline at end of file +}