# How to simulate from a step (simple function) hazard function?

I have a step hazard function $$h(t)$$ (a simple function that jumps at specific times and it is constant between those jumps). Something like:

How can I simulate survival times from this hazard function? Is there a clever way for doing so?

I was thinking of using the probability integral transform, by solving $$\exp\left[-\int_0^t h(s)ds \right] = u,$$ where $$u\sim U(0,1)$$, but I started wondering if there is a more efficient way for simulating these times.