pick_me_too 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +24 -0
- data/.gitignore +2 -2
- data/.ruby-version +1 -0
- data/CHANGES.md +8 -0
- data/Gemfile +5 -0
- data/README.md +4 -4
- data/Rakefile +2 -2
- data/lib/pick_me_too.rb +49 -61
- data/pick_me_too.gemspec +11 -9
- data/test/basic_test.rb +90 -2
- data/test/documentation_test.rb +2 -3
- metadata +21 -60
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 510b87a471ae9ebfef4f89f164182c05e2d3a0c3270c1e730ffc27c95ba00646
|
|
4
|
+
data.tar.gz: fe4f0efd9240c02d1e6fc4d967eeda9d55f786b8d864a932d5dc3bee3fcffc86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d581207db172f9525305f0f8ccac30f53edfcdb7c12e5578f37195a480c50e983820baf25cf69741e71c4f8d7e102da651882d01297475964aace6812972443e
|
|
7
|
+
data.tar.gz: 42f1dfacdbf6c002643b778c9f97693f9e30ae4c3569ac4bc96fac6c6e43ce05ff3b9b8a8e5d1c901f2c0ab33880ccd6c4cf42b8ebd790f50017dd1517110211
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0', 'head']
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: ruby/setup-ruby@v1
|
|
18
|
+
with:
|
|
19
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
20
|
+
bundler: latest
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: bundle install
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.1
|
data/CHANGES.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.0.0 *2026-11-28*
|
|
4
|
+
* replaced the `eval`-compiled tree of comparisons with [Vose's alias method](https://en.wikipedia.org/wiki/Alias_method): urn setup is O(n), every pick is O(1), and no code is generated with `eval` at runtime (brakeman no longer reports Dangerous Eval). ***NOTE***: as with 1.1.1, this is not considered a breaking API change, though it does change the sequence of items picked by a fixed random number sequence
|
|
5
|
+
* dropped support for Ruby < 3.1 (`required_ruby_version` is now `>= 3.1`)
|
|
6
|
+
* modernized development dependencies: minitest `>= 5.20, < 7`, rake `~> 13.0`; removed the unused `json` and `byebug` dependencies and the ancient `bundler ~> 1.7` pin
|
|
7
|
+
* added a `Gemfile`, gemspec `metadata`, and a GitHub Actions CI matrix (Ruby 3.1 through head)
|
|
8
|
+
* `.ruby-version` is now tracked in git
|
|
9
|
+
## 1.1.2 *2022-11-6*
|
|
10
|
+
* optimized ternerization code still further
|
|
3
11
|
## 1.1.1 *2022-10-30*
|
|
4
12
|
* simplified, and perhaps improved, the code to compile the frequency list into a nested ternary expression; ***NOTE***: I am not considering this a breaking change, though it may change the sequence of items picked by a fixed random number sequence
|
|
5
13
|
## 1.1.0 *2022-8-21*
|
data/Gemfile
ADDED
data/README.md
CHANGED
|
@@ -32,7 +32,7 @@ counter
|
|
|
32
32
|
# => {:bar=>15, :foo=>12, :baz=>5}
|
|
33
33
|
|
|
34
34
|
# you don't need to provide your own random number sequence
|
|
35
|
-
picker = PickMeToo({a: 1, b: 2, c: 3})
|
|
35
|
+
picker = PickMeToo.new({a: 1, b: 2, c: 3})
|
|
36
36
|
# ...
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -57,9 +57,9 @@ and then pick randomly from the array:
|
|
|
57
57
|
|
|
58
58
|
This is inefficient or impossible if the frequencies are huge or excessively precise. Say you want pi orcs in your list and e goblins.
|
|
59
59
|
|
|
60
|
-
`PickMeToo` requires just one item of each type. It converts the frequencies to probabilities and
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
`PickMeToo` requires just one item of each type. It converts the frequencies to probabilities and uses
|
|
61
|
+
[Vose's alias method](https://en.wikipedia.org/wiki/Alias_method): setting up the urn takes O(n) time and each
|
|
62
|
+
pick takes O(1) time, no matter how many items the urn contains or how skewed the frequencies are.
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
# API
|
data/Rakefile
CHANGED
data/lib/pick_me_too.rb
CHANGED
|
@@ -10,17 +10,22 @@
|
|
|
10
10
|
# # => [:goblin, :orc, :bugbear, :orc, :goblin, :bugbear, :goblin, :goblin, :orc, :goblin]
|
|
11
11
|
#
|
|
12
12
|
# irrational = PickMeToo.new({e: Math::E, pi: Math::PI})
|
|
13
|
-
#
|
|
13
|
+
# 10.times.map { irrational.pick }
|
|
14
14
|
# # => [:e, :e, :e, :pi, :e, :e, :e, :pi, :pi, :e]
|
|
15
15
|
#
|
|
16
16
|
# Items once picked are "placed back in the urn", so if you pick a cat this doesn't reduce the
|
|
17
|
-
# probability the next thing you pick is also a cat, and the urn will never be picked empty.
|
|
18
|
-
#
|
|
17
|
+
# probability the next thing you pick is also a cat, and the urn will never be picked empty.
|
|
18
|
+
#
|
|
19
|
+
# Sampling uses Vose's alias method: the urn is set up in O(n) time and each pick is O(1),
|
|
20
|
+
# regardless of how many items the urn contains.
|
|
19
21
|
class PickMeToo
|
|
20
|
-
VERSION = '
|
|
22
|
+
VERSION = '2.0.0'
|
|
21
23
|
|
|
22
24
|
class Error < StandardError; end
|
|
23
25
|
|
|
26
|
+
# The default source of randomness: a single call to Kernel#rand per pick.
|
|
27
|
+
DEFAULT_RNG = -> { rand }
|
|
28
|
+
|
|
24
29
|
##
|
|
25
30
|
# "Fill" the urn.
|
|
26
31
|
#
|
|
@@ -35,23 +40,22 @@ class PickMeToo
|
|
|
35
40
|
# - there are no pairs in the frequency list
|
|
36
41
|
# - any of the frequencies is non-positive
|
|
37
42
|
# - any of the items in the list isn't something followed by a number
|
|
38
|
-
def initialize(frequencies, rnd =
|
|
43
|
+
def initialize(frequencies, rnd = DEFAULT_RNG)
|
|
39
44
|
@rnd = rnd
|
|
40
|
-
|
|
41
|
-
@objects =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
else
|
|
45
|
-
root = balanced_binary_tree(frequencies)
|
|
46
|
-
# compile everything into a nested ternary expression
|
|
47
|
-
@picker = eval "->(p) { #{ternarize(root, 0)} }"
|
|
48
|
-
end
|
|
45
|
+
pairs = validate(Array(frequencies))
|
|
46
|
+
@objects = pairs.map(&:first)
|
|
47
|
+
@size = pairs.length
|
|
48
|
+
build_tables(pairs.map { |(_, weight)| weight.to_f })
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
##
|
|
52
52
|
# Pick an item from the urn.
|
|
53
53
|
def pick
|
|
54
|
-
@
|
|
54
|
+
scaled = @rnd.call * @size
|
|
55
|
+
i = scaled.to_i
|
|
56
|
+
i = 0 if i.negative?
|
|
57
|
+
i = @size - 1 if i >= @size
|
|
58
|
+
(scaled - i) < @prob[i] ? @objects[i] : @objects[@alias[i]]
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
##
|
|
@@ -63,66 +67,50 @@ class PickMeToo
|
|
|
63
67
|
#
|
|
64
68
|
# This is useful if you want to switch from a seeded random number generator
|
|
65
69
|
# to something more truly random.
|
|
66
|
-
def randomize!(rnd =
|
|
70
|
+
def randomize!(rnd = DEFAULT_RNG)
|
|
67
71
|
@rnd = rnd
|
|
68
72
|
end
|
|
69
73
|
|
|
70
74
|
private
|
|
71
75
|
|
|
72
|
-
# sanity check
|
|
73
|
-
def
|
|
74
|
-
raise Error, 'no frequencies given'
|
|
75
|
-
|
|
76
|
+
# sanity check of the frequencies
|
|
77
|
+
def validate(frequencies)
|
|
78
|
+
raise Error, 'no frequencies given' if frequencies.empty?
|
|
79
|
+
|
|
80
|
+
unless frequencies.all? { |pair| pair.is_a?(Array) && pair.length == 2 && pair[1].is_a?(Numeric) }
|
|
76
81
|
raise Error, 'all frequencies must be two-member arrays the second member of which is Numeric'
|
|
77
82
|
end
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
bad = frequencies.reject { |(_, weight)| weight.positive? }
|
|
80
85
|
raise Error, "the following have non-positive frequencies: #{bad.inspect}" if bad.any?
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
# sort by size of probability interval -- optimization step
|
|
84
|
-
good.sort_by(&:last).reverse.map { |o, n| [o, n / total] }
|
|
87
|
+
frequencies
|
|
85
88
|
end
|
|
86
89
|
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
def
|
|
90
|
-
|
|
91
|
-
frequencies
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
obj[:left] = left
|
|
96
|
-
right_idx = left_idx + 1
|
|
97
|
-
if (right = frequencies[right_idx])
|
|
98
|
-
obj[:right] = right
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
frequencies[0]
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
# what is the sum of all intervals under this node?
|
|
105
|
-
def sum(obj)
|
|
106
|
-
return 0 unless obj
|
|
107
|
-
|
|
108
|
-
obj[:sum] ||= begin
|
|
109
|
-
left = sum(obj[:left])
|
|
110
|
-
right = sum(obj[:right])
|
|
111
|
-
left + right + obj[:interval]
|
|
112
|
-
end
|
|
113
|
-
end
|
|
90
|
+
# Vose's alias method: precompute, for each of the n slots, a probability and an alias,
|
|
91
|
+
# so that a single random number in [0, 1) maps to an item in constant time.
|
|
92
|
+
def build_tables(weights)
|
|
93
|
+
n = weights.length
|
|
94
|
+
# normalize by the largest weight so even astronomically large frequencies cannot overflow
|
|
95
|
+
max = weights.max
|
|
96
|
+
total = weights.sum { |w| w / max }
|
|
97
|
+
scaled = weights.map { |w| w / max * n / total }
|
|
114
98
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
99
|
+
@prob = Array.new(n)
|
|
100
|
+
@alias = Array.new(n, 0)
|
|
101
|
+
small = []
|
|
102
|
+
large = []
|
|
103
|
+
scaled.each_with_index { |s, i| (s < 1.0 ? small : large) << i }
|
|
119
104
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
105
|
+
until small.empty? || large.empty?
|
|
106
|
+
s = small.pop
|
|
107
|
+
l = large.pop
|
|
108
|
+
@prob[s] = scaled[s]
|
|
109
|
+
@alias[s] = l
|
|
110
|
+
scaled[l] += scaled[s] - 1.0
|
|
111
|
+
(scaled[l] < 1.0 ? small : large) << l
|
|
125
112
|
end
|
|
126
|
-
|
|
113
|
+
# anything left over (float rounding) gets probability 1
|
|
114
|
+
(small + large).each { |i| @prob[i] = 1.0 }
|
|
127
115
|
end
|
|
128
116
|
end
|
data/pick_me_too.gemspec
CHANGED
|
@@ -16,17 +16,19 @@ Gem::Specification.new do |s|
|
|
|
16
16
|
DESC
|
|
17
17
|
s.authors = ['David F. Houghton']
|
|
18
18
|
s.email = 'dfhoughton@gmail.com'
|
|
19
|
-
s.homepage =
|
|
20
|
-
|
|
21
|
-
s.
|
|
22
|
-
s.required_ruby_version = '>= 2.5.3'
|
|
19
|
+
s.homepage = 'https://github.com/dfhoughton/pick_me_too'
|
|
20
|
+
s.license = 'MIT'
|
|
21
|
+
s.required_ruby_version = '>= 3.1'
|
|
23
22
|
s.files = `git ls-files -z`.split("\x0")
|
|
24
23
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
25
24
|
s.require_paths = ['lib']
|
|
26
25
|
|
|
27
|
-
s.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
s.metadata = {
|
|
27
|
+
'bug_tracker_uri' => 'https://github.com/dfhoughton/pick_me_too/issues',
|
|
28
|
+
'changelog_uri' => 'https://github.com/dfhoughton/pick_me_too/blob/main/CHANGES.md',
|
|
29
|
+
'source_code_uri' => 'https://github.com/dfhoughton/pick_me_too'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
s.add_development_dependency 'minitest', '>= 5.20', '< 7'
|
|
33
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
|
32
34
|
end
|
data/test/basic_test.rb
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require 'minitest/autorun'
|
|
4
4
|
|
|
5
5
|
require 'pick_me_too'
|
|
6
|
-
require 'byebug'
|
|
7
6
|
|
|
8
7
|
# :stopdoc:
|
|
9
8
|
|
|
@@ -31,7 +30,7 @@ class BasicTest < Minitest::Test
|
|
|
31
30
|
frequencies = [['cat', 1], ['dog', 2], ['horse', 3], ['camel', 4], ['lizard', 5], ['fish', 6]]
|
|
32
31
|
picker = PickMeToo.new(frequencies, -> { rnd.rand })
|
|
33
32
|
counter = Hash.new(0)
|
|
34
|
-
(frequencies.
|
|
33
|
+
(frequencies.sum { |(_, n)| n } * 1000).times { counter[picker.pick] += 1 }
|
|
35
34
|
frequencies.each do |key, n|
|
|
36
35
|
assert_equal n, (counter[key] / 1000.0).round, "right number of #{key}"
|
|
37
36
|
end
|
|
@@ -57,6 +56,12 @@ class BasicTest < Minitest::Test
|
|
|
57
56
|
end
|
|
58
57
|
end
|
|
59
58
|
|
|
59
|
+
def test_zero_frequency
|
|
60
|
+
assert_raises(PickMeToo::Error) do
|
|
61
|
+
PickMeToo.new([['foo', 1], ['bar', 0]])
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
60
65
|
def test_all_tuples
|
|
61
66
|
assert_raises(PickMeToo::Error,
|
|
62
67
|
'all frequencies must be two-member arrays the second member of which is Numeric') do
|
|
@@ -71,6 +76,52 @@ class BasicTest < Minitest::Test
|
|
|
71
76
|
end
|
|
72
77
|
end
|
|
73
78
|
|
|
79
|
+
def test_non_numeric_frequency
|
|
80
|
+
assert_raises(PickMeToo::Error) do
|
|
81
|
+
PickMeToo.new([['foo', 'a lot']])
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# force unary branching
|
|
86
|
+
def test_big
|
|
87
|
+
rnd = Random.new 1
|
|
88
|
+
frequencies = %w[a b c d e f g h].each_with_index.map { |k, i| [k, 2**i] }
|
|
89
|
+
picker = PickMeToo.new(frequencies, -> { rnd.rand })
|
|
90
|
+
counter = Hash.new(0)
|
|
91
|
+
(frequencies.sum { |(_, n)| n } * 6000).times { counter[picker.pick] += 1 }
|
|
92
|
+
frequencies.each do |key, n|
|
|
93
|
+
assert_equal n, (counter[key] / 6000.0).round, "right number of #{key}"
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# force binary branching
|
|
98
|
+
def test_small
|
|
99
|
+
rnd = Random.new 1
|
|
100
|
+
frequencies = %w[a b c d e f g h].each_with_index.map { |k, _i| [k, 1] }
|
|
101
|
+
picker = PickMeToo.new(frequencies, -> { rnd.rand })
|
|
102
|
+
counter = Hash.new(0)
|
|
103
|
+
(frequencies.sum { |(_, n)| n } * 6000).times { counter[picker.pick] += 1 }
|
|
104
|
+
frequencies.each do |key, n|
|
|
105
|
+
assert_equal n, (counter[key] / 6000.0).round, "right number of #{key}"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# many items: picks stay O(1) and the distribution stays right
|
|
110
|
+
def test_many_items
|
|
111
|
+
rnd = Random.new 1
|
|
112
|
+
frequencies = (1..1000).map { |i| ["item#{i}", i] }
|
|
113
|
+
picker = PickMeToo.new(frequencies, -> { rnd.rand })
|
|
114
|
+
counter = Hash.new(0)
|
|
115
|
+
100_000.times { counter[picker.pick] += 1 }
|
|
116
|
+
total = frequencies.sum { |(_, n)| n }.to_f
|
|
117
|
+
frequencies.each do |key, n|
|
|
118
|
+
expected = n / total * 100_000
|
|
119
|
+
# 4-sigma band, with a floor so that very rare items don't false-fail
|
|
120
|
+
delta = 4 * Math.sqrt(expected) + 5
|
|
121
|
+
assert_in_delta expected, counter[key], delta, "right number of #{key}"
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
74
125
|
def test_randomize
|
|
75
126
|
rnd1 = Random.new 1
|
|
76
127
|
rnd2 = Random.new 1
|
|
@@ -85,4 +136,41 @@ class BasicTest < Minitest::Test
|
|
|
85
136
|
ar2 = Array.new(100) { picker2.pick }
|
|
86
137
|
refute_equal ar1, ar2, 'if we randomize a picker, we get a new sequence'
|
|
87
138
|
end
|
|
139
|
+
|
|
140
|
+
def test_randomize_with_no_argument
|
|
141
|
+
picker = PickMeToo.new({ foo: 1, bar: 2 }, -> { 0.5 })
|
|
142
|
+
picker.randomize!
|
|
143
|
+
10.times { assert_includes [:foo, :bar], picker.pick }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# an rnd that returns exactly 1.0 must not blow up
|
|
147
|
+
def test_rnd_at_one
|
|
148
|
+
picker = PickMeToo.new({ a: 1, b: 1 }, -> { 1.0 })
|
|
149
|
+
assert_includes [:a, :b], picker.pick
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def test_rnd_at_zero
|
|
153
|
+
picker = PickMeToo.new({ a: 1, b: 1 }, -> { 0.0 })
|
|
154
|
+
assert_equal :a, picker.pick
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# astronomically large frequencies must not overflow
|
|
158
|
+
def test_huge_frequencies
|
|
159
|
+
rnd = Random.new 1
|
|
160
|
+
picker = PickMeToo.new({ a: 1e300, b: 1e300, c: 1 }, -> { rnd.rand })
|
|
161
|
+
counter = Hash.new(0)
|
|
162
|
+
3000.times { counter[picker.pick] += 1 }
|
|
163
|
+
assert_equal 0, counter[:c], 'c is effectively never picked'
|
|
164
|
+
assert counter[:a] + counter[:b] == 3000
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# fractional and irrational frequencies
|
|
168
|
+
def test_irrational_frequencies
|
|
169
|
+
rnd = Random.new 1
|
|
170
|
+
picker = PickMeToo.new({ e: Math::E, pi: Math::PI }, -> { rnd.rand })
|
|
171
|
+
counter = Hash.new(0)
|
|
172
|
+
6000.times { counter[picker.pick] += 1 }
|
|
173
|
+
assert_in_delta 6000 * Math::E / (Math::E + Math::PI), counter[:e], 200
|
|
174
|
+
assert_in_delta 6000 * Math::PI / (Math::E + Math::PI), counter[:pi], 200
|
|
175
|
+
end
|
|
88
176
|
end
|
data/test/documentation_test.rb
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
require 'minitest/autorun'
|
|
4
4
|
|
|
5
5
|
require 'pick_me_too'
|
|
6
|
-
require 'byebug'
|
|
7
6
|
|
|
8
7
|
# :stopdoc:
|
|
9
8
|
|
|
10
|
-
class
|
|
9
|
+
class DocumentationTest < Minitest::Test
|
|
11
10
|
def test_synopsis
|
|
12
11
|
rng = Random.new 1
|
|
13
12
|
picker = PickMeToo.new([['prevention', 1], ['cure', 16]], -> { rng.rand })
|
|
@@ -21,6 +20,6 @@ class BasicTest < Minitest::Test
|
|
|
21
20
|
picker = PickMeToo.new({ foo: 1, bar: 2, baz: 0.5 }, -> { rng.rand })
|
|
22
21
|
counter = Hash.new 0
|
|
23
22
|
32.times { counter[picker.pick] += 1 }
|
|
24
|
-
assert_equal({:
|
|
23
|
+
assert_equal({ bar: 15, foo: 12, baz: 5 }, counter)
|
|
25
24
|
end
|
|
26
25
|
end
|
metadata
CHANGED
|
@@ -1,91 +1,48 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pick_me_too
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David F. Houghton
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.7'
|
|
20
|
-
type: :development
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.7'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: byebug
|
|
13
|
+
name: minitest
|
|
29
14
|
requirement: !ruby/object:Gem::Requirement
|
|
30
15
|
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '9.1'
|
|
34
16
|
- - ">="
|
|
35
17
|
- !ruby/object:Gem::Version
|
|
36
|
-
version:
|
|
37
|
-
|
|
38
|
-
prerelease: false
|
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
41
|
-
- - "~>"
|
|
18
|
+
version: '5.20'
|
|
19
|
+
- - "<"
|
|
42
20
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: 9.1.0
|
|
47
|
-
- !ruby/object:Gem::Dependency
|
|
48
|
-
name: json
|
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - "~>"
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '2'
|
|
21
|
+
version: '7'
|
|
54
22
|
type: :development
|
|
55
23
|
prerelease: false
|
|
56
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
25
|
requirements:
|
|
58
|
-
- - "
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '2'
|
|
61
|
-
- !ruby/object:Gem::Dependency
|
|
62
|
-
name: minitest
|
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - "~>"
|
|
26
|
+
- - ">="
|
|
66
27
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '5'
|
|
68
|
-
|
|
69
|
-
prerelease: false
|
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
28
|
+
version: '5.20'
|
|
29
|
+
- - "<"
|
|
73
30
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
31
|
+
version: '7'
|
|
75
32
|
- !ruby/object:Gem::Dependency
|
|
76
33
|
name: rake
|
|
77
34
|
requirement: !ruby/object:Gem::Requirement
|
|
78
35
|
requirements:
|
|
79
36
|
- - "~>"
|
|
80
37
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
38
|
+
version: '13.0'
|
|
82
39
|
type: :development
|
|
83
40
|
prerelease: false
|
|
84
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
42
|
requirements:
|
|
86
43
|
- - "~>"
|
|
87
44
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
45
|
+
version: '13.0'
|
|
89
46
|
description: PickMeToo is a Ruby urn model. It allows you to generate an "urn" from
|
|
90
47
|
which you can randomly sample items with specified frequencies. This facilitates
|
|
91
48
|
modeling things that occur with known frequencies, like weather or wandering monsters.
|
|
@@ -94,8 +51,11 @@ executables: []
|
|
|
94
51
|
extensions: []
|
|
95
52
|
extra_rdoc_files: []
|
|
96
53
|
files:
|
|
54
|
+
- ".github/workflows/ci.yml"
|
|
97
55
|
- ".gitignore"
|
|
56
|
+
- ".ruby-version"
|
|
98
57
|
- CHANGES.md
|
|
58
|
+
- Gemfile
|
|
99
59
|
- LICENSE
|
|
100
60
|
- README.md
|
|
101
61
|
- Rakefile
|
|
@@ -106,8 +66,10 @@ files:
|
|
|
106
66
|
homepage: https://github.com/dfhoughton/pick_me_too
|
|
107
67
|
licenses:
|
|
108
68
|
- MIT
|
|
109
|
-
metadata:
|
|
110
|
-
|
|
69
|
+
metadata:
|
|
70
|
+
bug_tracker_uri: https://github.com/dfhoughton/pick_me_too/issues
|
|
71
|
+
changelog_uri: https://github.com/dfhoughton/pick_me_too/blob/main/CHANGES.md
|
|
72
|
+
source_code_uri: https://github.com/dfhoughton/pick_me_too
|
|
111
73
|
rdoc_options: []
|
|
112
74
|
require_paths:
|
|
113
75
|
- lib
|
|
@@ -115,15 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
115
77
|
requirements:
|
|
116
78
|
- - ">="
|
|
117
79
|
- !ruby/object:Gem::Version
|
|
118
|
-
version:
|
|
80
|
+
version: '3.1'
|
|
119
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
82
|
requirements:
|
|
121
83
|
- - ">="
|
|
122
84
|
- !ruby/object:Gem::Version
|
|
123
85
|
version: '0'
|
|
124
86
|
requirements: []
|
|
125
|
-
rubygems_version: 3.
|
|
126
|
-
signing_key:
|
|
87
|
+
rubygems_version: 3.6.2
|
|
127
88
|
specification_version: 4
|
|
128
89
|
summary: Randomly select items from a list with specified frequencies
|
|
129
90
|
test_files:
|