Sha256: 1c497b12cd81e38a96cd99072b2c5680a4642b439b20cde0af92dee0adb5936f

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# RandSum

generate random numbers that sum up to a given integer

## Package Installation

```bash
git clone git@gitlab.com:computalya/rand_sum.git
cd rand_sum
gem install rand_sum
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rand_sum'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rand_sum

## Usage

### examples 1

```ruby
400.rand_sum(2)
# => [153, 247]
```

### example 2
```ruby
result = 400.rand_sum(2)
puts "#{result} sum => #{result.inject(:+)}"
# => "[346, 54] sum => 400"
```

### example 3

```ruby
1000.rand_sum(5)
# => [691, 32, 104, 164, 9] => 1000
```

### in irb

```bash
require 'rand_sum'
# => true

100.rand_sum(5)
# => [22, 76, 2]
```

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Development Notes

### Adding new tags

```bash
git tag -a v0.1.0 -m 'rand_sum-0.1.0'
git push --tags all
```

### running tests

```bash
rake test

# or
ruby test/test_rand_sum.rb -v
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rand_sum-0.2.0 README.md