Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Explicitly defined random generator integer type sizes for more portability
authorFabien Chaix <chaix@ics.forth.gr>
Mon, 29 Feb 2016 20:25:28 +0000 (22:25 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Wed, 16 Mar 2016 15:43:53 +0000 (16:43 +0100)
teshsuite/surf/maxmin_bench/maxmin_bench.c

index 5fac7f1..8be76d6 100644 (file)
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
 
 double date;
-unsigned long seedx= 0;
+int64_t seedx= 0;
 
 static int myrand(void) {
   seedx=seedx * 16807 % 2147483647;
-  return seedx%1000;
+  return (int32_t) seedx%1000;
 }
 
 static double float_random(double max)
@@ -31,7 +32,7 @@ static double float_random(double max)
 
 static int int_random(int max)
 {
-  return (int) (((max * 1.0) * myrand()) / (MYRANDMAX + 1.0));
+  return (int32_t) (((max * 1.0) * myrand()) / (MYRANDMAX + 1.0));
 }
 
 static void test(int nb_cnst, int nb_var, int nb_elem, int pw_base_limit, int pw_max_limit, float rate_no_limit,