summaryrefslogtreecommitdiffstats
path: root/sysdep
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-08-17 22:47:40 +0200
committerMartin Mares <mj@ucw.cz>1999-08-17 22:47:40 +0200
commitf651941402079052fbdabf64092e7dd4a6a8cafe (patch)
tree9087136902af4fd9acf4965e63df372f45c8187a /sysdep
parentb332fcdfc8f0b1ac7111a63c55f72ba4b00b8035 (diff)
downloadbird-f651941402079052fbdabf64092e7dd4a6a8cafe.tar
bird-f651941402079052fbdabf64092e7dd4a6a8cafe.zip
Added a function for generating 32-bit random numbers.
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/unix/io.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index 5104664..fef1bd7 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -35,6 +35,20 @@
#include "lib/unix.h"
/*
+ * Random Numbers
+ */
+
+u32
+random_u32(void)
+{
+ long int rand_low, rand_high;
+
+ rand_low = random();
+ rand_high = random();
+ return (rand_low & 0xffff) | ((rand_high & 0xffff) << 16);
+}
+
+/*
* Timers
*/
@@ -823,6 +837,7 @@ io_init(void)
init_list(&global_event_list);
krt_io_init();
now = time(NULL);
+ srandom((int) now);
}
void