public static function getRandomDate(DateTime $startDate = null, $start = 1, $end = 100, $intervalTemplate = 'P%sD')
    {
        if (null === $startDate) {
            $startDate = new DateTime();
        }

        $start = (int)$start;
        $end = (int)$end;

        /*
         * Incorrect end of random partition?
         * Use start as the end of random partition
         */
        if ($end < $start) {
            $end = $start;
        }

        $randomDate = clone $startDate;
        $randomInterval = new DateInterval(sprintf($intervalTemplate, mt_rand($start, $end)));

        return $randomDate->add($randomInterval);
    }