1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 15:12:26 +08:00

feat: add Permutation and Combination

This commit is contained in:
dudaodong
2024-11-19 10:12:07 +08:00
parent 8322951475
commit 95a894e53f
3 changed files with 108 additions and 6 deletions

View File

@@ -502,3 +502,27 @@ func ExampleStdDev() {
// 1.41
// 1.55
}
func ExamplePermutation() {
result1 := Permutation(5, 3)
result2 := Permutation(5, 5)
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 60
// 120
}
func ExampleCombination() {
result1 := Combination(5, 3)
result2 := Combination(5, 5)
fmt.Println(result1)
fmt.Println(result2)
// Output:
// 10
// 1
}