An implementation of the Alias Method for generating a function that returns the value of a random variable with a specified probability. It is described in "On the alias method for generating random variables from a discrete distribution" by R.A. Kronmal and A.V. Peterson, The American Statistician, 33:214-218, 1979.