probability function for state change