From: Paul Brossier Date: Sun, 3 Mar 2013 19:10:45 +0000 (-0500) Subject: tests/utils_tests.h: add utils_init_random X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=474a573beece1af02259c2c3f194af2e88c0eafc;p=aubio.git tests/utils_tests.h: add utils_init_random --- diff --git a/tests/utils_tests.h b/tests/utils_tests.h index 4961f154..17fc3699 100644 --- a/tests/utils_tests.h +++ b/tests/utils_tests.h @@ -1,7 +1,18 @@ +#include #include #include +#include +#include -#define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO ERROR: " format , ##args) +#define PRINT_ERR(format, args...) fprintf(stderr, "AUBIO-TESTS ERROR: " format , ##args) #define PRINT_MSG(format, args...) fprintf(stdout, format , ##args) #define PRINT_DBG(format, args...) fprintf(stderr, format , ##args) -#define PRINT_WRN(...) fprintf(stderr, "AUBIO WARNING: " format, ##args) +#define PRINT_WRN(format, args...) fprintf(stderr, "AUBIO-TESTS WARNING: " format, ##args) + +void utils_init_random () { + time_t now = time(0); + struct tm *tm_struct = localtime(&now); + int seed = tm_struct->tm_sec; + //PRINT_WRN("current seed: %d\n", seed); + srandom (seed); +}