diff options
Diffstat (limited to 'src/platform.c')
-rw-r--r-- | src/platform.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/platform.c b/src/platform.c index 078fc93..7d6a94d 100644 --- a/src/platform.c +++ b/src/platform.c @@ -1,4 +1,5 @@ #ifdef __APPLE__ +#include <stdlib.h> #include <sys/types.h> #include <sys/sysctl.h> #elif linux @@ -32,6 +33,11 @@ int set_thread_affinity(pthread_t tid, int core) return 0; } +int get_random(int max) +{ + return arc4random() % max; +} + #endif #ifdef linux @@ -56,5 +62,10 @@ int set_thread_affinity(pthread_t tid, int core) core, strerrno()); return ret; } + +int get_random(int max) +{ + return random() % max; +} #endif |