RosettaCodeData/Task/Random-number-generator--device-/C/random-number-generator--device--3.c

19 lines
273 B
C
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
#include <inttypes.h>
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
int
main()
{
2014-01-17 05:32:22 +00:00
uint32_t v;
2013-04-10 23:57:08 -07:00
2014-01-17 05:32:22 +00:00
if (RAND_bytes((unsigned char *)&v, sizeof v) == 0) {
ERR_print_errors_fp(stderr);
return 1;
}
printf("%" PRIu32 "\n", v);
return 0;
2013-04-10 23:57:08 -07:00
}