From ea892d32e090c5d48d383646d67105f571877993 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 16 Jul 2018 18:44:56 -0400 Subject: ... --- src/util.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/util.cpp') diff --git a/src/util.cpp b/src/util.cpp index 2adb997..7125598 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -47,6 +47,10 @@ void event_add_with_timeout(struct event *ev, double timeout) { event_add(ev, &tv); } +double gen_rand_timeout(double base_timeout, double alpha) { + return base_timeout + rand() / (double)RAND_MAX * alpha * base_timeout; +} + const std::string get_current_datetime() { /* credit: http://stackoverflow.com/a/41381479/544806 */ char fmt[64], buf[64]; -- cgit v1.2.3