diff options
Diffstat (limited to 'nacl/randombytes/test.c')
-rw-r--r-- | nacl/randombytes/test.c | 15 |
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 | |||
3 | unsigned char x[65536]; | ||
4 | unsigned long long freq[256]; | ||
5 | |||
6 | int 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 | } | ||