spicy-proton 2.0.0 → 2.0.1
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/README.md +1 -1
- data/lib/corpus/adjectives.bin +0 -0
- data/lib/corpus/adjectives.yaml +4767 -4772
- data/lib/corpus/nouns.bin +0 -0
- data/lib/corpus/nouns.yaml +10674 -10691
- data/lib/disk-corpus.rb +1 -1
- data/lib/memory-corpus.rb +1 -1
- data/lib/seek.rb +9 -4
- metadata +3 -3
data/lib/disk-corpus.rb
CHANGED
data/lib/memory-corpus.rb
CHANGED
data/lib/seek.rb
CHANGED
@@ -2,6 +2,8 @@ require 'securerandom'
|
|
2
2
|
|
3
3
|
module Spicy
|
4
4
|
module Seek
|
5
|
+
private
|
6
|
+
|
5
7
|
def seek(opts = {}, &found)
|
6
8
|
min, max, length = opts[:min], opts[:max], opts[:length]
|
7
9
|
|
@@ -17,10 +19,8 @@ module Spicy
|
|
17
19
|
max = [max || length || @max, @max].min
|
18
20
|
|
19
21
|
rand_min = @cumulative[min - 1] || 0
|
20
|
-
rand_max = @cumulative[max] || @cumulative[@max]
|
21
|
-
|
22
|
-
range = rand_max - rand_min + 1
|
23
|
-
index = rand_min + SecureRandom.random_number(range)
|
22
|
+
rand_max = (@cumulative[max] || @cumulative[@max]) - 1
|
23
|
+
index = rand(rand_min, rand_max)
|
24
24
|
|
25
25
|
min.upto(max) do |len|
|
26
26
|
if @cumulative[len] > index
|
@@ -30,5 +30,10 @@ module Spicy
|
|
30
30
|
|
31
31
|
nil
|
32
32
|
end
|
33
|
+
|
34
|
+
def rand(low, high)
|
35
|
+
range = high - low + 1
|
36
|
+
low + SecureRandom.random_number(range)
|
37
|
+
end
|
33
38
|
end
|
34
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spicy-proton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schmich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -77,5 +77,5 @@ rubyforge_project:
|
|
77
77
|
rubygems_version: 2.6.8
|
78
78
|
signing_key:
|
79
79
|
specification_version: 4
|
80
|
-
summary: Generate a random adjective-noun word pair.
|
80
|
+
summary: Generate a random English adjective-noun word pair.
|
81
81
|
test_files: []
|