monte_carlo 0.0.6 → 0.0.7
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 +9 -0
- data/lib/monte_carlo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e982e4c691d1727d209a88dd129a31b9118b6e26
|
4
|
+
data.tar.gz: 0fb0dba7ee9dcbad1c6c78faf14b4a370180326d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42aaa3bfb0fdf59aac78e3a810bb5f21083e4a2b30c1d3fb00e2155396cf37d18d0896e838a7002df93ff3e0d1cc63892dc2cdc270bf7f583ecec7f83c33d504
|
7
|
+
data.tar.gz: c5038110cc5a7109caf001a33b8d35e22458431f370c94f4310d3535d1889a3ccbc4cdbe6c0a1055a7b338a3c73f47ac7422263b0d9ceb62a4ef4fbf7acc14ca
|
data/README.md
CHANGED
@@ -21,6 +21,7 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
Every `MonteCarlo::Experiment` must have a sample method to generate random samples. The samples generated when the experiment is run will be collected into a `MonteCarlo::ExperimentResults` object after an optional computation method to turn the random sample into a meaningful value.
|
24
|
+
|
24
25
|
For example, the sample method may draw a random number between 1 and 10 and the computation method will test whether the number is greater than 5, returning `true` or `false` results.
|
25
26
|
|
26
27
|
```ruby
|
@@ -39,6 +40,14 @@ results.probability_distribution
|
|
39
40
|
|
40
41
|
Or run it with the shorthand class method syntax:
|
41
42
|
|
43
|
+
```ruby
|
44
|
+
# Use one method for both sample and computation and run immediately
|
45
|
+
results = MonteCarlo::Experiment.run(1000000) do
|
46
|
+
sample = rand(10)
|
47
|
+
sample >= 5
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
42
51
|
## Docs
|
43
52
|
|
44
53
|
[Can be found here](http://www.rubydoc.info/gems/monte_carlo)
|
data/lib/monte_carlo/version.rb
CHANGED