tiny_outcome 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_outcome.rb +6 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 117564a93dd35781e19d6f1420eb763f2a39ed5feb38a7a3bd3279ad8f1ed4d2
4
- data.tar.gz: 5dd7829f20e626b261a004ef3f83a8e48d8e978fc8d400d36f63d62e6f6bfd42
3
+ metadata.gz: c42e1143dcbebc9e17795c5972896594ca2efd105efb6dc57c6994396e2f50a9
4
+ data.tar.gz: ff222da29f706b0c362b8f6901a10efaf6df4428ee18414e709fc2f9722b94f2
5
5
  SHA512:
6
- metadata.gz: 02c0184cb9692db7ffce8fd91cd1ec1b830df1b0bebf453c7fd25744ead1cc2af5ba2e9c990b4eed23d3668231edeb79840b4121ddf65d5ac2bbf57a6e1a85c5
7
- data.tar.gz: 3fb696f998d6598d04453b5dbe1ac70216ff340884b9a6d89a6b990338619e7c34197b43a10d7a2403ea4b5ff3ba915cd988c4c1a5b0982c6f39ca7383538006
6
+ metadata.gz: a8059baa7359247f5c60198d517c8e5d3e05706c75e54347068788f450ea6bf0d438db7ae8c05df7264aaab48083697953e3d13c0f8795d2215b080c1ad3fb26
7
+ data.tar.gz: e04fbe290c68b7d1226f02cda213044cf0fd0c24784a1359404133b1895d099ff5eae1192d113231ae0ba71fa920d191dd2e8cf2179b5eb2bb6c8e51b02c4b08
data/lib/tiny_outcome.rb CHANGED
@@ -132,16 +132,16 @@ class TinyOutcome
132
132
  sum = 0.0
133
133
  raw = (full? ? @value.rotate(@value_index) : @value)[..(samples-1)]
134
134
  group_size = [@samples, 100].min
135
- num_groups = @samples - group_size
135
+ num_groups = (@samples - group_size) + 1
136
136
  raw.each_cons(group_size) do |samples_group|
137
- curr = samples_group.count(1) / samples.to_f
138
- sum += curr
137
+ num_ones = samples_group.count(1) / group_size.to_f
138
+ sum += num_ones
139
139
 
140
- @min = curr if curr < @min
141
- @max = curr if curr > @max
140
+ @min = num_ones if num_ones < @min
141
+ @max = num_ones if num_ones > @max
142
142
  end
143
143
 
144
- @avg = sum / (@num_groups.to_f + 1.0)
144
+ @avg = sum / num_groups.to_f
145
145
  end
146
146
 
147
147
  # convenient way to see what's up
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_outcome
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-08 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest