...
Code Block | ||||
---|---|---|---|---|
| ||||
#include<Wincrypt.h> HCRYPTPROV hCryptProv; union { BYTE bs[sizeof(long int)]; long int li; } rand_buf; if (!CryptGenRandom(hCryptProv, sizeof(rand_buf&li), &rand_bufli) { /* Handle error */ } else { printf("Random number: %ld\n", rand_buf.li); } |
Risk Assessment
Using the rand()
function leads to possibly predictable random numbers.
...