This is a copy of the same function from rpexp from package
msm.
Copied here to reduce dependencies.
rpexp(n = 1, rate = 1, t = 0)number of observations. If length(n) > 1, the length is
taken to be the number required.
vector of rates.
vector of the same length as rate, giving the times at which
the rate changes. The values of t should be in increasing order.