kujibiki 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kujibiki/core_ext/array.rb +2 -2
- data/lib/kujibiki/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0baf99db6191159260aaeceba7edd02fd7441b77
|
4
|
+
data.tar.gz: 14ada7b149034609388758a7e4e77393c8c39d2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9a1e58e234cd2e7d730b6b8ce5ee21e08a42dbdc83d81abcc0375e87d2aa8b0ff32e8befe3168962ddf15f0ae90226361e13a49465406e1360970026a53cae
|
7
|
+
data.tar.gz: 92890a95bd72140405bdbbab6439f7ada412d68b59941c3d9a75a5ac4e1ea872eaca415b2ca91af2cd470f3ee4769fad13b23e65ac061c4b5b3f50d19505a821
|
@@ -3,8 +3,8 @@ class Array
|
|
3
3
|
def sample(n = 1, random: nil, weight: nil)
|
4
4
|
return _sample(n, random: random) unless weight
|
5
5
|
|
6
|
-
unless weight.select {|w| w > 0}.size
|
7
|
-
raise ArgumentError, "weight size must be larger than sample number(#{n})"
|
6
|
+
unless weight.select {|w| w > 0}.size >= n
|
7
|
+
raise ArgumentError, "weight size must be larger than or equal to sample number(#{n})"
|
8
8
|
end
|
9
9
|
|
10
10
|
sum = weight.inject(0.0, :+)
|
data/lib/kujibiki/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kujibiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoki Shimizu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|