X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Falgorithm.c;h=e6b9132b0649dfc17c845eb267ff0ea3a06a1973;hb=d31103641648cfc48746b1765d7c0e52c3dfb714;hp=89e813defa12b7ce4b3588ce194a7dc0dfb99e9c;hpb=b9e28aa5614a079548c616bcf97aa804024ad647;p=pspp-builds.git diff --git a/src/algorithm.c b/src/algorithm.c index 89e813de..e6b9132b 100644 --- a/src/algorithm.c +++ b/src/algorithm.c @@ -91,11 +91,12 @@ #include #include "algorithm.h" +#include #include #include #include #include "alloc.h" -#include "random.h" +#include "settings.h" /* Some of the assertions in this file are very expensive. We don't use them by default. */ @@ -310,7 +311,8 @@ is_partitioned (const void *array, size_t count, size_t size, unsigned algo_default_random (unsigned max, void *aux UNUSED) { - return rng_get_unsigned (pspp_rng ()) % max; + unsigned long r_min = gsl_rng_min (get_rng ()); + return (gsl_rng_get (get_rng ()) - r_min) % max; } /* Randomly reorders ARRAY, which contains COUNT elements of SIZE @@ -511,7 +513,10 @@ lexicographical_compare_3way (const void *array1, size_t count1, Engineering a sort function; Jon Bentley and M. Douglas McIlroy; Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */ +#ifdef HAVE_ALLOCA_H #include +#endif + #include #include #include