+
+static unsigned long long get_rand_start_delay(struct thread_data *td)
+{
+ unsigned long long delayrange;
+ unsigned long r;
+
+ delayrange = td->o.start_delay_high - td->o.start_delay;
+
+ if (td->o.use_os_rand) {
+ r = os_random_long(&td->delay_state);
+ delayrange = (unsigned long long) ((double) delayrange * (r / (OS_RAND_MAX + 1.0)));
+ } else {
+ r = __rand(&td->__delay_state);
+ delayrange = (unsigned long long) ((double) delayrange * (r / (FRAND_MAX + 1.0)));
+ }
+
+ delayrange += td->o.start_delay;
+ return delayrange;
+}
+