Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.26 KB

README.md

File metadata and controls

47 lines (31 loc) · 1.26 KB

Gocap

Calculate permutations and combinations in go

Installation

With a correctly configured Go toolchain:

go get -u github.com/jaumecapdevila/gocap

Usage

First of all you need to create a new instance of the Operation struct using the NewOperation constructor:

operation := NewOperation(3, 1, false)

This constructor receives three parameters:

  1. N: the number of different types
  2. R: the number of types to choose
  3. Repetition: Indicates if its possible or not to repeat a type

Now, you can use the CombinationCalculator and the PermutationCalculator to get the result of the operation:

calculator := NewCombinationCalculator()

result := calculator.Calculate(operation)

Meta

Jaume Capdevila – @otherjaumecontact@jaumecapdevila.net

Distributed under the MIT license.

https://github.com/jaumecapdevila/gocap

Contributing

  1. Fork it (https://github.com/jaumecapdevila/gocap/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request