generation of random variables from a truncated distribution