BUG: Fix a bug in 'timedelta_range' that produced an extra point on a edge case (fix #30353)
The issue from #30353 came actually from `timedelta_range`.

```python
import pandas as pd

def mock_timedelta_range(start=None, end=None, periods=None, freq=None, name=None, closed=None):
    epoch = pd.Timestamp(0)
    if start is not None:
        start = epoch + pd.Timedelta(start)
    if end is not None:
        end = epoch + pd.Timedelta(end)
    res = pd.date_range(start=start, end=end, periods=periods, freq=freq, name=name, closed=closed)
    res -= epoch
    res.freq = freq
    return res

print(mock_timedelta_range("1day", "10day", freq="2D"))
print(pd.timedelta_range("1day", "10day", freq="2D"))
```

The outputs from `mock_timedelta_range` and from `pd.timedelta_range` are supposed to equivalent, but are not on pandas v1.0.0:
Outputs without this PR:
```
TimedeltaIndex(['1 days', '3 days', '5 days', '7 days', '9 days'], dtype='timedelta64[ns]', freq='2D')
TimedeltaIndex(['1 days', '3 days', '5 days', '7 days', '9 days', '11 days'], dtype='timedelta64[ns]', freq='2D')
```

Outputs with this PR:
```
TimedeltaIndex(['1 days', '3 days', '5 days', '7 days', '9 days'], dtype='timedelta64[ns]', freq='2D')
TimedeltaIndex(['1 days', '3 days', '5 days', '7 days', '9 days'], dtype='timedelta64[ns]', freq='2D')
```

----
It also solve an issue (that fail on master) related to this comment: https://github.com/pandas-dev/pandas/issues/13022#issuecomment-238382933

```python
import pandas as pd
rng = pd.timedelta_range(start='1d', periods=10, freq='d')
df = pd.Series(range(10), index=rng)
df.resample('2D').count()
```
Outputs with this PR:
```
1 days    2
3 days    2
5 days    2
7 days    2
9 days    2
Freq: 2D, dtype: int64
```

----

On the firsts commits I just fixed the issue in `_generate_regular_range`, then I decided to do a refactor and to use the same code that generate ranges in `core/arrays/_ranges.py` for `date_range` and `timedelta_range`.

Linked with #10887.

----

- [X] closes #30353
       closes #13022
       closes #7687 (for loffset when resampling Timedelta)
- [X] tests added / passed
- [X] passes `black pandas`
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Hello @hasB4K! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:















There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-05-09 16:24:27 UTC A few comments on the refactor, but i really like the idea of re-using generate_regular_range LGTM Just rebased with master @WillAyd over to you > lgtm a couple of questions.

Thank you! :slightly_smiling_face:
I have just answered on those and fixed the issue on the test you mentioned earlier.

Let me know if you need anything else! thanks @hasB4K very nice!