vose 0.1.0 → 0.1.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.
- data/README.md +7 -7
- data/lib/vose/version.rb +1 -1
- data/vose.gemspec +1 -1
- metadata +11 -11
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Vose: Sample random values from a discrete probability distribution.
|
2
2
|
|
3
|
-
Vose is a Ruby implementation of the Vose Alias Method. It allows for
|
4
|
-
sampling of random values from a
|
5
|
-
|
6
|
-
after a O(n) initialization.
|
3
|
+
Vose is a Ruby implementation of the Vose Alias Method. It allows for
|
4
|
+
sampling of random values from a discrete probability distribution.
|
5
|
+
In simpler terms, this gem simulates a loaded die. This implementation
|
6
|
+
runs in O(1) time after after a O(n) initialization.
|
7
7
|
|
8
8
|
For more information on the theory, have a look at [Darts, Dice, and Coins: Sampling from a Discrete Distribution](http://www.keithschwarz.com/darts-dice-coins/)
|
9
9
|
|
@@ -28,10 +28,10 @@ Or install it yourself as:
|
|
28
28
|
## Usage
|
29
29
|
|
30
30
|
probabilities = [0.4, 0.1, 0.2, 0.3]
|
31
|
-
vose = Vose::AliasMethod.new
|
32
|
-
choice = vose.next
|
31
|
+
vose = Vose::AliasMethod.new probabilities
|
32
|
+
choice = vose.next # => an int
|
33
33
|
|
34
|
-
The choice will be an index of the
|
34
|
+
The choice will be an index of the probabilities array.
|
35
35
|
|
36
36
|
## Contributing
|
37
37
|
|
data/lib/vose/version.rb
CHANGED
data/vose.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["bryan@osesm.com"]
|
7
7
|
gem.description = %q{Vose: Sample random values from a discrete probability distribution.
|
8
8
|
}
|
9
|
-
gem.summary = %q{Vose is a Ruby implementation of the Vose Alias Method. It allows for sampling of random values from a
|
9
|
+
gem.summary = %q{Vose is a Ruby implementation of the Vose Alias Method. It allows for sampling of random values from a discrete probability distribution or in others words, rolling a loaded die.}
|
10
10
|
gem.homepage = "https://github.com/thunderboltlabs/vose"
|
11
11
|
|
12
12
|
gem.files = `git ls-files`.split($\)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
16
|
-
requirement: &
|
16
|
+
requirement: &70162015828460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70162015828460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: ruby_gntp
|
27
|
-
requirement: &
|
27
|
+
requirement: &70162015828000 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70162015828000
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: guard-minitest
|
38
|
-
requirement: &
|
38
|
+
requirement: &70162015827520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70162015827520
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: guard-bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70162015827040 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70162015827040
|
58
58
|
description: ! 'Vose: Sample random values from a discrete probability distribution.
|
59
59
|
|
60
60
|
'
|
@@ -98,7 +98,7 @@ rubygems_version: 1.8.11
|
|
98
98
|
signing_key:
|
99
99
|
specification_version: 3
|
100
100
|
summary: Vose is a Ruby implementation of the Vose Alias Method. It allows for sampling
|
101
|
-
of random values from a
|
101
|
+
of random values from a discrete probability distribution or in others words, rolling
|
102
102
|
a loaded die.
|
103
103
|
test_files:
|
104
104
|
- spec/spec_helper.rb
|