Should I ignore $0$ when do inverse transform sampling? Generic method 


*

*Generate $U \sim \mathrm{Uniform}(0,1)$.

*Return $F^{-1}(U)$.


So, in step 1, $U$ has domain/support as $[0,1]$, so it is possible that $U=0$ or $U=1$,
but $F^{-1}(0)=-\infty$. Should I reject the value $U=0$ and $U=1$ before applying step 2?
For example, discrete distribution sampling: $X$ takes on values $x_1, x_2, x_3$ with probability $p_1,p_2,p_3$


*

*Generate $U \sim \mathrm{Uniform}(0,1)$.

*Find the smallest $k$ such that $F(x_k)\geq U$  ($F$ is the CDF).


However, if $U=0$, and $p_1=0$, $k$ would be $1$. It could generate $x_1$ though its probability $p_1=0$. Is it acceptable?

In theory, it doesn't matter: the event $U=0$ occurs with probability $0$, and can thus be ignored.  (In probabilistic jargon, it almost never happens.)
In practice, it's possible that your PRNG may return a value that is exactly $0$.  For a reasonably good PRNG, this is unlikely, but it may not be quite unlikely enough for you to bet that it never happens.  Thus, if your program would crash on $U=0$, a prudent programmer should check for that event and generate a new random number if it occurs.
(Note that many PRNG routines are defined to return values in the range $0 \le U < 1$: for example, the Java default PRNG is defined to return values of the form $m\cdot2^{-53}$ for $m \in \{0,1,\dotsc,2^{53}-1\}$.  If you're using such a PRNG, a cheap but effective way to avoid the case $U=0$ is to use the number $1-U$ instead of $U$.)
