Changes rand() to rand_r()
[platform/core/api/audio-io.git] / test / audio_io_test.c
index 5f88826..51c82bf 100644 (file)
@@ -731,11 +731,10 @@ static void *thread_stress_test_audio_in(void *data)
        int buffer_size;
        audio_channel_e ch;
        audio_sample_type_e type;
+       unsigned int seed = (unsigned int)time(NULL);
 
        audio_in_h input = (audio_in_h)data;
 
-       srand(time(NULL));
-
        audio_in_prepare(input);
        audio_in_get_buffer_size(input, &buffer_size);
        buf = (char *)malloc(buffer_size);
@@ -745,7 +744,7 @@ static void *thread_stress_test_audio_in(void *data)
        }
 
        for (i=0; i<TEST_COUNT; i++) {
-               switch (rand() % 8) {
+               switch (rand_r(&seed) % 8) {
                        case 0:
                                audio_in_prepare(input);
                                break;
@@ -800,6 +799,7 @@ static void *thread_stress_test_audio_out(void *data)
        int buffer_size;
        audio_channel_e ch;
        audio_sample_type_e type;
+       unsigned int seed = (unsigned int)time(NULL);
 
        audio_out_h output = (audio_out_h)data;
 
@@ -815,7 +815,7 @@ static void *thread_stress_test_audio_out(void *data)
 
        audio_out_prepare(output);
        for (i = 0; i < TEST_COUNT; i++) {
-               switch (rand() % 9) {
+               switch (rand_r(&seed) % 9) {
                        case 0:
                                audio_out_prepare(output);
                                break;