Mercurial > librandom
comparison main.c @ 0:9ee92e7a1cb5 default tip
*: initial commit
this is a very simple, bare-bones randomness API. if the system can't provide
it, so be it -- init will fail.
author | Paper <paper@tflc.us> |
---|---|
date | Tue, 10 Jun 2025 16:18:50 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9ee92e7a1cb5 |
---|---|
1 #include <stdio.h> | |
2 #include <stdint.h> | |
3 #include <inttypes.h> | |
4 #include <time.h> | |
5 | |
6 #include "librandom.h" | |
7 | |
8 int main(void) | |
9 { | |
10 clock_t start, end; | |
11 int i; | |
12 uint32_t x; | |
13 struct random r; | |
14 | |
15 random_init(&r); | |
16 | |
17 start = clock(); | |
18 | |
19 for (i = 0; i < 1000000; i++) | |
20 random_read(&r, &x, sizeof(x)); | |
21 | |
22 end = clock(); | |
23 | |
24 printf("%f\n", (double)(end - start) / CLOCKS_PER_SEC); | |
25 | |
26 random_close(&r); | |
27 | |
28 return 0; | |
29 } |