check_probability

Function check_probability 

Source
pub fn check_probability<T, S>(p: T, name: S) -> CoreResult<T>
where T: Float + Display + Copy, S: Into<String>,
Expand description

Checks if a probability value is valid (between 0 and 1, inclusive)

§Arguments

  • p - The probability value to check
  • name - The name of the parameter being checked

§Returns

  • Ok(p) if the probability is valid
  • Err(CoreError::ValueError) if the probability is not valid

§Errors

Returns CoreError::ValueError if the probability is not between 0 and 1.