cirq.validate_probability

Validates that a probability is between 0 and 1 inclusively.

p The value to validate.
p_str What to call the probability in error messages.

The probability p if the probability if valid.

ValueError If the probability is invalid.