* derivatives without specific, written prior permission.
*/
+#include <config.h>
#include "random.h"
#include <errno.h>
struct timeval tv;
inited = true;
if (gettimeofday(&tv, NULL) < 0) {
- fatal(errno, "gettimeofday");
+ ofp_fatal(errno, "gettimeofday");
}
srand(tv.tv_sec ^ tv.tv_usec);
}
random_bytes(&x, sizeof x);
return x;
}
+
+int
+random_range(int max)
+{
+ return random_uint32() % max;
+}