#include <limits.h>
#include <math.h>
-#ifdef _WIN32
-/*
- * Windows
- * XXX: we have to use this ugly defined(__GNUC__) because it is not easy to
- * detect the compiler used in distutils itself
- */
-#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND))
-
/*
- * FIXME: ideally, we should set this to the real version of MSVCRT. We need
- * something higher than 0x601 to enable _ftime64 and co
- */
-#define __MSVCRT_VERSION__ 0x0700
-#include <time.h>
-#include <sys/timeb.h>
-
-/*
- * mingw msvcr lib import wrongly export _ftime, which does not exist in the
- * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which
- * is available in those versions of the runtime
- */
-#define _FTIME(x) _ftime64((x))
-#else
-#include <time.h>
-#include <sys/timeb.h>
-#define _FTIME(x) _ftime((x))
-#endif
-
-#ifndef RK_NO_WINCRYPT
-/* Windows crypto */
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
-#endif
-#include <windows.h>
-#include <wincrypt.h>
-#endif
+#ifdef _WIN32
-#else
-/* Unix */
-#include <time.h>
-#include <sys/time.h>
-#include <unistd.h>
-#endif
+// * Windows
+// * XXX: we have to use this ugly defined(__GNUC__) because it is not easy to
+// * detect the compiler used in distutils itself
+// */
+//#if (defined(__GNUC__) && defined(NPY_NEEDS_MINGW_TIME_WORKAROUND))
+//
+///*
+// * FIXME: ideally, we should set this to the real version of MSVCRT. We need
+// * something higher than 0x601 to enable _ftime64 and co
+// */
+//#define __MSVCRT_VERSION__ 0x0700
+//#include <time.h>
+//#include <sys/timeb.h>
+//
+///*
+// * mingw msvcr lib import wrongly export _ftime, which does not exist in the
+// * actual msvc runtime for version >= 8; we make it an alias to _ftime64, which
+// * is available in those versions of the runtime
+// */
+//#define _FTIME(x) _ftime64((x))
+//#else
+//#include <time.h>
+//#include <sys/timeb.h>
+//#define _FTIME(x) _ftime((x))
+//#endif
+//
+//#ifndef RK_NO_WINCRYPT
+///* Windows crypto */
+//#ifndef _WIN32_WINNT
+//#define _WIN32_WINNT 0x0400
+//#endif
+//#include <windows.h>
+//#include <wincrypt.h>
+//#endif
+//
+//#else
+///* Unix */
+//#include <time.h>
+//#include <sys/time.h>
+//#include <unistd.h>
+//#endif
#include "randomkit.h"
}
// it is much faster to shuffle term rather than pointers to term, even though the swap is more expensive
static rk_state rstate;
-void fisheryates_shuffle(term *terms, int n_terms) {
+static void fisheryates_shuffle(term *terms, int n_terms) {
int i;
for (i=n_terms-1; i>=1; i--) {
// srand48() is called in neatoinit.c, so no need to seed here
//int j = (int)(drand48() * (i+1));
- // TODO: better RNG because shuffling is eating up at least 50% of computation
-
int j = rk_interval(i, &rstate);
term temp = terms[i];