combination is a lib to do math jobs like permutate and combinate data from vec.
```rust extern crate combination; use combination::permutate::*;
fn testpermutation() { let data = vec![10, 20, 30, 40]; let val = permutatevec(&data); for item in val { println!("{:?}", item); } } ```
Get combination data from a vec
rust
extern crate combination;
use combination::combine::*;
let val = combine_vec(&vec![10, 20, 30, 40], 2);
for item in val {
println!("{:?}", item);
}
[10, 20]
[10, 30]
[10, 40]
[20, 30]
[20, 40]
[30, 40]
Get permutation data from a vec
rust
extern crate combination;
use combination::permutate::_;
let val = permutate_vec(&vec![10, 20, 30, 40]);
for item in val {
println!("{:?}", item);
}
[30, 10, 40, 20]
[30, 10, 20, 40]
[40, 10, 30, 20]
[10, 40, 30, 20]
[10, 30, 40, 20]
[10, 30, 20, 40]
[40, 10, 20, 30]
[10, 40, 20, 30]
[10, 20, 40, 30]
[10, 20, 30, 40]
[40, 30, 20, 10]
[30, 40, 20, 10]
[30, 20, 40, 10]
[30, 20, 10, 40]
[40, 20, 30, 10]
[20, 40, 30, 10]
[20, 30, 40, 10]
[20, 30, 10, 40]
[40, 20, 10, 30]
[20, 40, 10, 30]
[20, 10, 40, 30]
[20, 10, 30, 40]