Calculate probability using permutations (#762)