...
Code Block | ||||
---|---|---|---|---|
| ||||
#ifndef _CRT_RAND_S #define _CRT_RAND_S 1 #endif #include <stdio.h> #include <stdlib.h> int func(void) { unsigned int number; errno_t err; err = rand_s( &number); if (err != 0) { /* handle error */ } else { printf("Random number: %u\n", number); } } |
Risk Assessment
The use of the rand()
function can result in predictable random numbers.
...