kujibiki 0.1.0 → 0.1.1
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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c15f84430bcdb50219d65e81cffccffc19a1241
|
4
|
+
data.tar.gz: 0fc821e5eef9b1207e9b1894b83bfeceeb1d419d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d62ea5c513d06cb4f368d829b747dccfcfe630f9abcf00462791ea05608b8dc2501b0b14c6b0ec979512054312ae3fea25797e425e8b0427971bdba891d520
|
7
|
+
data.tar.gz: ea9e2bd101d5c74f4d7e0960df60e6c70e65e09c51e893c5428e91542c0cc14c63c0a7293a2ee2fff9a2d45720b706bb5d13cfd3bce010f1a08373cc853a3b06
|
@@ -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
|
6
|
+
unless weight.select {|w| w > 0}.size > n
|
7
|
+
raise ArgumentError, "weight size must be larger than sample number(#{n})"
|
8
8
|
end
|
9
9
|
|
10
10
|
sum = weight.inject(0.0, :+)
|
data/lib/kujibiki/version.rb
CHANGED