summaryrefslogtreecommitdiffstats
path: root/sysdep/unix/random.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2000-06-05 13:46:40 +0200
committerMartin Mares <mj@ucw.cz>2000-06-05 13:46:40 +0200
commit10304bed435034cf8432b1c6262f7e7f0d84d49c (patch)
tree471236b143caba0d839237b795f4dfd514b0298c /sysdep/unix/random.c
parent5cc1e1f805934952f38ceb2ca6947c6d2e704937 (diff)
downloadbird-10304bed435034cf8432b1c6262f7e7f0d84d49c.tar
bird-10304bed435034cf8432b1c6262f7e7f0d84d49c.zip
Split random number functions off io.c, so that they can be documented
separately.
Diffstat (limited to 'sysdep/unix/random.c')
-rw-r--r--sysdep/unix/random.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sysdep/unix/random.c b/sysdep/unix/random.c
new file mode 100644
index 0000000..b1f5086
--- /dev/null
+++ b/sysdep/unix/random.c
@@ -0,0 +1,21 @@
+/*
+ * BIRD Internet Routing Daemon -- Random Numbers
+ *
+ * (c) 2000 Martin Mares <mj@ucw.cz>
+ *
+ * Can be freely distributed and used under the terms of the GNU GPL.
+ */
+
+#include <stdlib.h>
+
+#include "nest/bird.h"
+
+u32
+random_u32(void)
+{
+ long int rand_low, rand_high;
+
+ rand_low = random();
+ rand_high = random();
+ return (rand_low & 0xffff) | ((rand_high & 0xffff) << 16);
+}