aliastable 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88cae2e262098e88436d41789056946a36ec55270d4e52c33242f5018b687595
4
- data.tar.gz: e6b9c4befb4950137807729b171178b0210c794693a1045dbd94ea10606aa593
3
+ metadata.gz: 8feca45e9779e9e3d95c111939f1d5f7774e4473d79e7964b839e990429be380
4
+ data.tar.gz: d87f6a2fe3c6fc6bca9b0ffb23e16dbebd833055a1a67b6a939d1eb7a0e89dcf
5
5
  SHA512:
6
- metadata.gz: 294e9171f62c9602f1eb3fe9886daeb1fb899431d906e26a33d95c0af4398bad147a62b7e2eee8f7d52a736dd4aa57a67bbf2e5b767ed847817eae59409b7bcf
7
- data.tar.gz: 545e97af416b1d7ad20f81444811343eafb0d0ec74a30ce2b5b754cfb4336d8aefb337b907fa4b1b7453da796b5d4b48da941b9840bfeb878c3bff4bc7f614e8
6
+ metadata.gz: fc4b9b8d60a670dfc96ca7a20730140750ab2b573027e088b4abeee5f8b1f09fc3aedcf190cdfeeeb6cc53721ade41cc12554ab8317b0686e6cf782ce9f757e9
7
+ data.tar.gz: bce9850229bf8f3af2b00dd54da9a707fd762b31354fe20164401e6a568b10939b4dd8ee8c9970648889c30df66060c735439748e3dd9d322b1b9baf1ddc6d92
data/aliastable.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # -*- ruby -*-
2
- _VERSION = "4.0.0"
2
+ _VERSION = "4.0.1"
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "aliastable"
6
6
  s.version = _VERSION
7
- s.date = "2023-01-21"
7
+ s.date = "2023-03-08"
8
8
  s.summary = "Efficiently generate random outcomes from an arbitrary categorical distribution."
9
9
  s.email = "pjs@alum.mit.edu"
10
10
  s.description = "If a categorical distribution has k distinct values, traditional approaches will require O(k) work to pick an outcome with the correct probabilities. This algorithm uses conditional probability to construct a table which will yield outcomes with the correct probabilities. Table generation requires O(k) time, but subsequent generation is done in O(1) time."
@@ -16,5 +16,9 @@ Gem::Specification.new do |s|
16
16
  ]
17
17
  s.required_ruby_version = '>= 2.6.0'
18
18
  s.license = 'MIT'
19
- s.metadata["homepage_uri"] = s.homepage
19
+ s.metadata = {
20
+ "source_code_uri" => s.homepage,
21
+ "homepage_uri" => s.homepage,
22
+ "documentation_uri" => "https://www.rubydoc.info/gems/aliastable"
23
+ }
20
24
  end
data/lib/aliastable.rb CHANGED
@@ -54,7 +54,7 @@ class AliasTable
54
54
  end
55
55
  end
56
56
  @enum = Enumerator.new do |y|
57
- loop do
57
+ while true
58
58
  column = rand(len)
59
59
  y << ((rand <= p_primary[column]) ? x[column] : col_alias[column])
60
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliastable
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul J Sanchez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-21 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: If a categorical distribution has k distinct values, traditional approaches
14
14
  will require O(k) work to pick an outcome with the correct probabilities. This
@@ -26,7 +26,9 @@ homepage: https://bitbucket.org/paul_j_sanchez/aliastable
26
26
  licenses:
27
27
  - MIT
28
28
  metadata:
29
+ source_code_uri: https://bitbucket.org/paul_j_sanchez/aliastable
29
30
  homepage_uri: https://bitbucket.org/paul_j_sanchez/aliastable
31
+ documentation_uri: https://www.rubydoc.info/gems/aliastable
30
32
  post_install_message:
31
33
  rdoc_options: []
32
34
  require_paths:
@@ -42,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
44
  - !ruby/object:Gem::Version
43
45
  version: '0'
44
46
  requirements: []
45
- rubygems_version: 3.4.3
47
+ rubygems_version: 3.4.7
46
48
  signing_key:
47
49
  specification_version: 4
48
50
  summary: Efficiently generate random outcomes from an arbitrary categorical distribution.