@@ -24,10 +24,12 @@ #include #include +#include + #ifdef __QNX__ # include #endif #import "OFObject.h" @@ -97,10 +99,11 @@ Class isa; } alloc_failed_exception; size_t of_pagesize; size_t of_num_cpus; +uint32_t of_hash_seed; #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { @@ -273,10 +276,24 @@ # ifdef _SC_NPROCESSORS_CONF if ((of_num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 1) # endif of_num_cpus = 1; #endif + +#if defined(OF_HAVE_ARC4RANDOM) + of_hash_seed = arc4random(); +#elif defined(OF_HAVE_RANDOM) + struct timeval t; + gettimeofday(&t, NULL); + srandom(t.tv_usec); + of_hash_seed = random(); +#else + struct timeval t; + gettimeofday(&t, NULL); + srand(t.tv_usec); + of_hash_seed = rand(); +#endif } + (void)initialize { }