summaryrefslogtreecommitdiff
path: root/nacl/randombytes/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/randombytes/test.c')
-rw-r--r--nacl/randombytes/test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/nacl/randombytes/test.c b/nacl/randombytes/test.c
new file mode 100644
index 00000000..646811ca
--- /dev/null
+++ b/nacl/randombytes/test.c
@@ -0,0 +1,15 @@
1#include "randombytes-impl.h"
2
3unsigned char x[65536];
4unsigned long long freq[256];
5
6int main()
7{
8 unsigned long long i;
9
10 randombytes(x,sizeof x);
11 for (i = 0;i < 256;++i) freq[i] = 0;
12 for (i = 0;i < sizeof x;++i) ++freq[255 & (int) x[i]];
13 for (i = 0;i < 256;++i) if (!freq[i]) return 111;
14 return 0;
15}