Hm I see what youâ€™re saying. The CDF of the survival time T is

P(T \le t) = 1 - S(t) = 1 - \exp \left[- \int_0^{t} \lambda(t) \, dt \right].

For t =0, this probability is zero, and as t increases the probability increases until it eventually gets to one. I think we could just draw a uniform random number, u \sim \mathrm{Uniform}(0,1) then we could integrate the above formula until P(T \le t) = u. The result would be a sample of the survival time T that follows the correct distribution. This integration scheme would be done in the generated quantities.

The only thing is youâ€™d need a function that would integrate P(T \le t) up until a specified u, but that wouldnâ€™t be too difficult. For example if youâ€™re using forward Euler as your integration scheme I imagine you can do something like the following (in R)

```
integrate_up_to_u <- function(lambda, u, TOLERANCE) {
Lambda <- 0.0
t <- 0.0
for(n in 1:MAX_ITERS) {
dt <- select_stepsize(lambda, TOLERANCE)
t <- t + dt
Lambda <- Lambda + lambda(t)*dt
P <- 1 - exp(-Lambda)
if (P >= u) {
return(t)
}
}
}
```

Youâ€™d have to sort out the minor details like how to backtrack if youâ€™re over-integrated past the specified tolerance, but thatâ€™s the basic idea.