Implementing a probability distribution