}
gdouble
-rspamd_time_jitter (gdouble in, gdouble jitter)
+rspamd_random_double (void)
{
guint64 rnd_int;
double res;
res = rnd_int;
res *= transform_bias;
+ return res;
+}
+
+gdouble
+rspamd_time_jitter (gdouble in, gdouble jitter)
+{
if (jitter == 0) {
jitter = in;
}
- return in + jitter * res;
+ return in + jitter * rspamd_random_double ();
}
gboolean
*/
gdouble rspamd_time_jitter (gdouble in, gdouble jitter);
+/**
+ * Return random double in range [0..1)
+ * @return
+ */
+gdouble rspamd_random_double (void);
+
/**
* Constant time version of memcmp
*/