@@ -227,42 +227,10 @@ *extra = (char*)instance + instanceSize + extraAlignment; return instance; } -uint32_t -of_random() -{ -#if defined(OF_HAVE_ARC4RANDOM) - return arc4random(); -#elif defined(OF_HAVE_RANDOM) - static BOOL initialized = NO; - - if (!initialized) { - struct timeval t; - - gettimeofday(&t, NULL); - srandom((unsigned)(t.tv_sec ^ t.tv_usec)); - initialized = YES; - } - - return (uint32_t)((random() << 16) | (random() & 0xFFFF)); -#else - static BOOL initialized = NO; - - if (!initialized) { - struct timeval t; - - gettimeofday(&t, NULL); - srand((unsigned)(t.tv_sec ^ t.tv_usec)); - initialized = YES; - } - - return (rand() << 16) | (rand() & 0xFFFF); -#endif -} - const char* _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; @@ -309,11 +277,23 @@ if ((of_num_cpus = sysconf(_SC_NPROCESSORS_CONF)) < 1) # endif of_num_cpus = 1; #endif - of_hash_seed = of_random(); +#if defined(OF_HAVE_ARC4RANDOM) + of_hash_seed = arc4random(); +#elif defined(OF_HAVE_RANDOM) + struct timeval t; + gettimeofday(&t, NULL); + srandom((unsigned)(t.tv_sec ^ t.tv_usec)); + of_hash_seed = (uint32_t)((random() << 16) | (random() & 0xFFFF)); +#else + struct timeval t; + gettimeofday(&t, NULL); + srand((unsigned)(t.tv_sec ^ t.tv_usec)); + of_hash_seed = (uint32_t)((rand() << 16) | (rand() & 0xFFFF)); +#endif } + (void)initialize { }