Synopsis: | Don't use the functions rand. Instead use the re-entrant counterpart rand_r. |
Language: | C |
Severity Level: | 5 |
Category: | Library |
Description: |
Justification Non-reentrant functions can cause problems when multiple threads are used or memory is shared between tasks (such as on VxWorks). Example #include <stdlib.h> int rand(void); /* WRONG */ int rand_r(unsigned *seed); /* RIGHT */ Note Function rand_r is not available on VxWorks in kernel space. |