Generating discrete random variables in a computer