private static long randomMillis(Random rnd) {
        long millis = rnd.nextLong();
        if (millis >= 0) {
            millis = millis % MAX_MILLIS;
        } else {
            millis = millis % -MIN_MILLIS;
        }
        return millis;
    }