weighted_list 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +35 -0
- data/README.md +2 -1
- data/lib/weighted_list.rb +4 -0
- data/lib/weighted_list/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925e9f3a1fba2c35de1dd9825b28702353798b5a4cbdf63e603fab141926577d
|
4
|
+
data.tar.gz: cc4b917a7322de3eeddc18f00910d432d731bc24957a52bce4041a6f17ee996a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cefce48130c7db1b3d7a8f2c1b167f5e49ffbad70a7133142f1e70a41ec70326536ad71b1efc4d27f7716330af33af704e57e427f073fb2f268e1faa8ab7bab0
|
7
|
+
data.tar.gz: 3ae2f07dbdf47e3a41d5f31453b242ec0a5bc0cb4596f240aa7ed27e74a81296a236af31337299fb9f48fa8c87c910339b12052f1f201827cc3c9e83bc910831
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
weighted_list (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.6.0)
|
12
|
+
rspec-core (~> 3.6.0)
|
13
|
+
rspec-expectations (~> 3.6.0)
|
14
|
+
rspec-mocks (~> 3.6.0)
|
15
|
+
rspec-core (3.6.0)
|
16
|
+
rspec-support (~> 3.6.0)
|
17
|
+
rspec-expectations (3.6.0)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.6.0)
|
20
|
+
rspec-mocks (3.6.0)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.6.0)
|
23
|
+
rspec-support (3.6.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.16)
|
30
|
+
rake (~> 10.0)
|
31
|
+
rspec (~> 3.0)
|
32
|
+
weighted_list!
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
1.16.5
|
data/README.md
CHANGED
@@ -26,7 +26,8 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
```ruby
|
29
|
-
|
29
|
+
hash = { eastern: 150, central: 92, mountain: 21, pacific: 53 }
|
30
|
+
list = WeightedList[hash]
|
30
31
|
|
31
32
|
list.sample # => :pacific
|
32
33
|
list.sample(1) # => [:central]
|
data/lib/weighted_list.rb
CHANGED