58 |
#include "memory.h" |
#include "memory.h" |
59 |
#include "log.h" |
#include "log.h" |
60 |
#include "numeric.h" |
#include "numeric.h" |
61 |
|
#include "rng_mt.h" |
62 |
|
|
63 |
|
|
64 |
static const char *last_event_ran = NULL; |
static const char *last_event_ran = NULL; |
65 |
static struct ev_entry event_table[MAX_EVENTS]; |
static struct ev_entry event_table[MAX_EVENTS]; |
134 |
void |
void |
135 |
eventAddIsh(const char *name, EVH *func, void *arg, time_t delta_ish) |
eventAddIsh(const char *name, EVH *func, void *arg, time_t delta_ish) |
136 |
{ |
{ |
137 |
if (delta_ish >= 3.0) |
if (delta_ish >= 3) |
138 |
{ |
{ |
139 |
const time_t two_third = (2 * delta_ish) / 3; |
const time_t two_third = (2 * delta_ish) / 3; |
140 |
delta_ish = two_third + ((rand() % 1000) * two_third) / 1000; |
delta_ish = two_third + ((genrand_int32() % 1000) * two_third) / 1000; |
141 |
/* |
/* |
142 |
* XXX I hate the above magic, I don't even know if its right. |
* XXX I hate the above magic, I don't even know if its right. |
143 |
* Grr. -- adrian |
* Grr. -- adrian |