commit all the code!
[detour.git] / random_bits.c
diff --git a/random_bits.c b/random_bits.c
new file mode 100644 (file)
index 0000000..4377244
--- /dev/null
@@ -0,0 +1,13 @@
+#include "devurandom.c"
+#include <stdint.h>
+#include <stdio.h>
+
+int main(void) {
+  // yup, this is cheap and slow :D
+  char bits[65];
+  randombytes(bits, sizeof(bits));
+  for (int i=0; i<sizeof(bits); i++) bits[i] = '0' + (1&bits[i]);
+  bits[sizeof(bits)-1] = '\0';
+  puts(bits);
+  return 0;
+}