rangefinder 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDc0ODg1YWVmNDQxYzM2MjYwZDk5MDU4ODk5YzUxY2I5MWNiNDk2YQ==
4
+ MDA0NzE5MTdlNGNjYzU0MmViMjc3MDIwMzJkNzJlYzFjODI3YTNjYQ==
5
5
  data.tar.gz: !binary |-
6
- ZWZkMWU0ZWY5MDFjZTJiNjNmOTU3YjA0MDI0YWQyYTE1YzdlN2MwOQ==
6
+ NGJhOGU3ZjdmY2QzNGExZTUwN2QyMWY4ZWVlOTU4NmRiZGNkMDY0Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTdkODg4ODk5NGQ4MGU4MDk5ZTU2ZDNjOTQxY2Q2MDU1N2Y5N2I5YWNmZjIz
10
- NzdhNzYxMDk0OTY4ZWIzM2E5ZTM4MWZhMDMxZDg1NmYxZWE5MWM4ODQ1Mjdi
11
- NDU5ZWJlOWRkOWNjNjk0MTE2ZmVkMzRiOTIyM2U3ODZmNjg3ODA=
9
+ MWRjMDYwODcxMDEzMzc5OTk3NGYxMDEyZDVkZTlhMjI4YTlhY2NiYWE0NGJh
10
+ ZWJlOTUyYzYzOWEyM2U0ODE0ZTZjNGQ2ZDdkMTU5OWNmZDMwNWQyMDQyOTQy
11
+ ODRjNjhiNjYxNzllMzY5Mjk2MTE3NjZjODFjYmExZGZlNzFlMWM=
12
12
  data.tar.gz: !binary |-
13
- NTIyZTc1YmQ3YjA4ZTcyMDhiN2I2MWQ2NGFjNWE2YzBhN2FjMDBlMzdlMDk0
14
- ZDkxYTE1OGQwZmNmNTcyZjk4YTE1YmJkYTEyY2NiMTJiOGE0MTYzMTA0NTZm
15
- ZWNmNjViNzgxM2ZiZWUzMWM4MzQzY2UxNGJhZDY1MWJhYjgzOTY=
13
+ M2FlMTQxZWNmYjExMDNlYTBlYWU4ZGZiY2ZkNmYzZGIxZmY5MjdiNzcwMzI0
14
+ MjcwNDk5MTQ0YzQzMGM4NWIyZTUxZmZjYjgyNDM4NmFiYzFlMGQxY2JjMTYw
15
+ MzNmYjIyNTI3NDhjZWZlODA0YTEyMTY1YjA1MjJkN2Q3ZGVhYWY=
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.0.4 / 2014-01-13
2
+
3
+ * Enhancements
4
+
5
+ * Pass a random number generator as :random in order to get the same sampled ids (in case script stops)
6
+
1
7
  0.0.3 / 2014-01-13
2
8
 
3
9
  * Enhancements
@@ -27,6 +27,7 @@ class Rangefinder
27
27
  last = [options.fetch(:last, MAX), MAX].min.round
28
28
  max_gap = options.fetch(:max_gap, MAX_GAP)
29
29
  samp = options.fetch(:samp, INIT_SAMP)
30
+ random = options.fetch(:random, ::Random.new)
30
31
  if samp >= MAX_SAMP
31
32
  memo.ranges << (first..last)
32
33
  else
@@ -52,7 +53,7 @@ class Rangefinder
52
53
  gap = 0
53
54
  end
54
55
  samp1 = gap > 10 ? samp * Math.log(gap, 10) : samp
55
- i += (rand(100) * (1 - samp1)).round
56
+ i += (random.rand(100) * (1 - samp1)).round
56
57
  end until i >= last or (gap > max_gap and anything) # sorry for mixed metaphor
57
58
  end
58
59
  end
@@ -1,3 +1,3 @@
1
1
  class Rangefinder
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rangefinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere