Let $X$ be a Gaussian random variable where for simplicity, $X \sim N(0,1)$. I am interested in generating samples of $X$ in the following cases: $X \mid X \in (a,b)$ where $a < b$ or $X \mid X > b$. I am aware that I can do rejection sampling for this and especially for the latter, Wikipedia says (under rejection sampling) that exponential tilting is a very efficient manner to generate samples for $X \mid X>b$. I am wondering though: is there a better way to do this without rejection sampling? In other words, do algorithms exist wherein the above scenarios can be sampled by just a simple scaling/translation of a random variable that can be easily sampled?
Thoughts/comments appreciated. Thanks!
It is easy enough if you have the cumulative distribution function $\Phi(x)$ and inverse cumulative distribution function $\Phi^{-1}(y)$ of a standard normal distribution:
and if you just want to ensure $X \gt a$ then $b=+\infty$ and $\Phi(b)=1$
For example in R:
gives