added the function that compute the probability of messages