add a function that calculate a probability of the next element.