/// Calculate the number of combinations when choosing
/// k elements from n elements without replacement, multiplied by a scaling factor.
Calculate the number of combinations when choosing
k elements from n elements without replacement, multiplied by a scaling factor.
Calculate the number of combinations when choosing k elements from n elements without replacement multiplied by a scaling factor .
pub fn scaled_combinations(n: u64, k: u64, scale: f64) -> f64 {
    if k > n {
        0.0
    } else {
        let mut comb = scale;
        for j in 0..cmp::min(k, n - k) {
            comb /= (j + 1) as f64;
            comb *= (n - j) as f64;
        }
        comb
    }
}
pub fn scaled_combinations ( n : u64 , k : u64 , scale : f64 ) -> f64 { if k > n { 0.0 } else { let mut comb = scale ; for j in 0 .. cmp :: min ( k , n - k ) { comb /= ( j + 1 ) as f64 ; comb *= ( n - j ) as f64 ; } comb } }
Calculate the number of combinations when choosing
k elements from n elements without replacement, multiplied by a scaling factor.
Calculate the number of combinations when choosing k elements from n elements without replacement multiplied by a scaling factor .
n
u64
k
u64
scale
f64