Function mathol::stochastics::probability::variation [] [src]

pub fn variation<T>(n: T, k: T) -> Result<T, MatholError> where
    T: PrimInt + Integer + Product

Calculates how many times the elements of a given set can be arranged in a particular order without repetition.

Remarks

All elements in the set are different from each other.

n is the total number of elements in the set.

k is the number of elements that are picked from the set.

Returns the number of possible variations or an error message if k is bigger than n.

Examples

assert_eq!(336, variation(8, 3).unwrap());