Computes the modal (most common) value in a dataset.
+
+
Returns a pair with the modal value and the bin-count for the modal bin.
+If there is more than one such value, no guarantees are made which one will be picked.
+
+
NOTE computing the mode requires traversing the entire dataset.
#mean: a pre-computed #mean. This could be a pre-computed sample's mean
+ or the population's known mean. If a mean is not provided, then the sample's
+ mean will be computed. Default is nil.
corrected: when set to true, then the sum of squares is scaled
+ with values.size - 1, rather than with values.size. Default is false.
#mean: a pre-computed #mean. This could be a pre-computed sample's mean
+ or the population's known mean. If a mean is not provided, then the sample's
+ mean will be computed. Default is nil.
corrected: when set to true, then the sum of squares is scaled
+ with values.size - 1, rather than with values.size. Default is false.
see https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables https://www.johndcook.com/SimpleRNG.cpp https://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/
see https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables
+https://www.johndcook.com/SimpleRNG.cpp
+https://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/
+
+
diff --git a/docs/index.json b/docs/index.json
new file mode 100644
index 0000000..c282c0a
--- /dev/null
+++ b/docs/index.json
@@ -0,0 +1 @@
+{"repository_name":"github.com/lbarasti/statistics","body":"\n[](https://opensource.org/licenses/MIT)\n\n# statistics\n\nA statistical library to perform descriptive statistics and generate random values based on popular probability distributions.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n```yaml\ndependencies:\n statistics:\n github: lbarasti/statistics\n```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"statistics\"\n```\n\n### Descriptive statistics\nYou can compute mean, variance and standard deviation of a collection as follows.\n```crystal\ninclude Statistics\n\nx = [1, 10, 7]\nmean(x) # 6\nvar(x) # 14\nvar(x, corrected: true) # 21\nvar(x, mean: 8) # 18.0\nstd(x) # 3.7416...\n```\n\n### Sampling\nTo work with distributions, import the `Distributions` namespace as follows.\n```crystal\ninclude Statistics::Distributions\n```\n\nNow, here is how we sample values from a normal distribution with `mean = 1.5` and `std = 0.2`.\n```crystal\nNormal.new(1.5, 0.2).rand\n```\n\nWe can generate an iterable of normally distributed random values as follows.\n```crystal\ngen = Normal.new(1.5, 0.2)\n1000.times.map { gen.rand }\n```\n\n#### Supported distributions\nThe following distributions are supported:\n* Constant\n* Exponential\n* Normal\n* Poisson\n* Uniform\n\nDon't see your favourite one on the list? Just fork the repo, add your distribution to the `distributions.cr` file, and open a PR.\n\n## Development\n\nThis shard is a work in progress. Everyone's contribution is welcome.\n\nThe guiding principle at this stage is\n> make it work before you make it right\n\nWhich in this context means: let's not focus on benchmarks and performance, but rather on usability and correctness.\n\n## References\n* [numpy.random](https://numpy.org/devdocs/reference/random/generator.html): distributions and random sampling\n* [numpy statistics](https://numpy.org/devdocs/reference/routines.statistics.html#averages-and-variances): order statistics, averages and variances\n* [scipy stats](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py) module and related [tests](https://github.com/scipy/scipy/blob/1150c4c033899a5a4556b7d34d6b137352b36b9e/scipy/stats/tests/test_stats.py) tests\n* [julia random](https://docs.julialang.org/en/v1/stdlib/Random/) module\n* [julia statistics](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.std) module\n* [julia distributions](https://juliastats.org/Distributions.jl/latest/starting/) package.\n* on [skewness and kurtosis](https://brownmath.com/stat/shape.htm), by Stan Brown\n* more on [skewness and kurtosis](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm), from NIST.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [lbarasti](https://github.com/lbarasti) - creator and maintainer\n","program":{"html_id":"github.com/lbarasti/statistics/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"github.com/lbarasti/statistics","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"github.com/lbarasti/statistics/Statistics","path":"Statistics.html","kind":"module","full_name":"Statistics","name":"Statistics","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"lib/distributions.cr","line_number":1,"url":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr"},{"filename":"statistics.cr","line_number":6,"url":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr"}],"repository_name":"github.com/lbarasti/statistics","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.1.0\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[{"html_id":"github.com/lbarasti/statistics/Statistics","kind":"module","full_name":"Statistics","name":"Statistics"}],"subclasses":[],"including_types":[],"namespace":null,"doc":"Basic descriptive statistics functionality.\n\nMore flexible than a scientific-calculator, but not as exhaustive, yet.","summary":"
Basic descriptive statistics functionality.
","class_methods":[],"constructors":[],"instance_methods":[{"id":"describe(values)-instance-method","html_id":"describe(values)-instance-method","name":"describe","doc":"Computes several descriptive statistics of the passed array.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes several descriptive statistics of the passed array.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L14","def":{"name":"describe","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"size = values.size\nsorted = values.sort\n{mean: mean(values), var: var(values), std: std(values), skewness: skew(values), kurtosis: kurtosis(values), min: sorted.first, max: sorted.last, q1: quantile(sorted, 0.25, sorted: true), median: median(sorted, sorted: true), middle: middle(sorted), q3: quantile(sorted, 0.75, sorted: true)}\n"}},{"id":"frequency(values:Enumerable(T))forallT-instance-method","html_id":"frequency(values:Enumerable(T))forallT-instance-method","name":"frequency","doc":"Computes the number of occurrences of each value in the dataset.\n\nReturns a Hash with each the dataset values as keys and the number of times they appear as value.\n\nParameters\n- `values`: a one-dimensional dataset","summary":"
Computes the number of occurrences of each value in the dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable(T)"}],"args_string":"(values : Enumerable(T)) forall T","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L38","def":{"name":"frequency","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable(T)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"values.reduce(Hash(T, Int32).new(0)) do |freq, v|\n __temp_24 = v\n freq[__temp_24] = freq[__temp_24] + 1\n freq\nend"}},{"id":"kurtosis(values,corrected=false,excess=false)-instance-method","html_id":"kurtosis(values,corrected=false,excess=false)-instance-method","name":"kurtosis","doc":"Computes the kurtosis of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `corrected`: when set to `true`, then the calculations are corrected for statistical bias. Default is `false`.\n- `excess`: when set to `true`, computes the [excess kurtosis](https://en.wikipedia.org/wiki/Kurtosis#Excess_kurtosis). Default is `false`.\n\nThis implementation is based on the [scipy/stats.py](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py#L1142).","summary":"
Computes the kurtosis of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""},{"name":"excess","doc":null,"default_value":"false","external_name":"excess","restriction":""}],"args_string":"(values, corrected = false, excess = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L53","def":{"name":"kurtosis","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""},{"name":"excess","doc":null,"default_value":"false","external_name":"excess","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"n = values.size\nm = mean(values)\nm4 = moment(values, m, 4)\nm2 = moment(values, m, 2)\nkurt = if corrected\n (((1 / (n - 2)) / (n - 3)) * (((((n ** 2) - 1) * m4) / (m2 ** 2)) - (3 * ((n - 1) ** 2)))) + 3\nelse\n m4 / (m2 ** 2)\nend\nexcess ? kurt - 3 : kurt\n"}},{"id":"mean(values)-instance-method","html_id":"mean(values)-instance-method","name":"mean","doc":"Computes the mean of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes the mean of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L72","def":{"name":"mean","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(values.reduce(0) do |acc, v|\n acc + v\nend) / values.size"}},{"id":"median(values,sorted=false)-instance-method","html_id":"median(values,sorted=false)-instance-method","name":"median","doc":"Computes the median of all elements in a dataset.\n\nFor an even number of elements the mean of the two median elements will be computed.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `sorted`: when `true`, the computations assume that the provided values are\n sorted. Default is `false`.\n\nSee Julia's [Statistics.median](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.median).","summary":"
Computes the median of all elements in a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"args_string":"(values, sorted = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L86","def":{"name":"median","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"size = values.size\nmid = size // 2\nsorted_values = sorted ? values : values.sort\nif size.odd?\n sorted_values[mid]\nelse\n middle([sorted_values[mid - 1], sorted_values[mid]])\nend\n"}},{"id":"middle(a,b)-instance-method","html_id":"middle(a,b)-instance-method","name":"middle","doc":"Computes the middle of two values `a` and `b`.","summary":"
Computes the middle of two values a and b.
","abstract":false,"args":[{"name":"a","doc":null,"default_value":"","external_name":"a","restriction":""},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":""}],"args_string":"(a, b)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L111","def":{"name":"middle","args":[{"name":"a","doc":null,"default_value":"","external_name":"a","restriction":""},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"0.5 * (a + b)"}},{"id":"middle(values)-instance-method","html_id":"middle(values)-instance-method","name":"middle","doc":"Computes the middle of an array `a`, which consists of finding its\nextrema and then computing their mean.\n\nParameters\n- `values`: a one-dimensional dataset.\n\nSee Julia's [Statistics.middle](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.middle).","summary":"
Computes the middle of an array a, which consists of finding its extrema and then computing their mean.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L105","def":{"name":"middle","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"min, max = values.minmax\nmiddle(min, max)\n"}},{"id":"mode(values:Enumerable)-instance-method","html_id":"mode(values:Enumerable)-instance-method","name":"mode","doc":"Computes the modal (most common) value in a dataset.\n\nReturns a pair with the modal value and the bin-count for the modal bin.\nIf there is more than one such value, no guarantees are made which one will be picked.\nNOTE: computing the mode requires traversing the entire dataset.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes the modal (most common) value in a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable"}],"args_string":"(values : Enumerable)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L123","def":{"name":"mode","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(frequency(values)).max_by(&.last)"}},{"id":"moment(values,mean=nil,n=1)-instance-method","html_id":"moment(values,mean=nil,n=1)-instance-method","name":"moment","doc":"Calculates the n-th moment about the mean for a sample.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `n`: Order of central moment that is returned. Default is `1`.","summary":"
Calculates the n-th moment about the mean for a sample.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"n","doc":null,"default_value":"1","external_name":"n","restriction":""}],"args_string":"(values, mean = nil, n = 1)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L134","def":{"name":"moment","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"n","doc":null,"default_value":"1","external_name":"n","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"m = mean || (Statistics.mean(values))\n(values.reduce(0) do |a, b|\n a + ((b - m) ** n)\nend) / values.size\n"}},{"id":"quantile(values,p,sorted=false)-instance-method","html_id":"quantile(values,p,sorted=false)-instance-method","name":"quantile","doc":"Computes the quantile of a dataset at a specified probability `p` on the interval [0,1].\n\nQuantiles are computed via linear interpolation between the points `((k-1)/(n-1), v[k])`,\nfor `k = 1:n` where `n = values.size`.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `p`: probability. Values of `p` should be in the interval `[0, 1]`.\n- `sorted` indicates whether `values` can be assumed to be sorted.\n\nImplementation based on Julia's [Statistics.quantile](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.quantile).","summary":"
Computes the quantile of a dataset at a specified probability p on the interval [0,1].
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"p","doc":null,"default_value":"","external_name":"p","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"args_string":"(values, p, sorted = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L150","def":{"name":"quantile","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"p","doc":null,"default_value":"","external_name":"p","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"sorted_values = sorted ? values : values.sort\nn = values.size\naleph = (n - 1) * p\nj = (clamp(aleph.floor, 0, n - 2)).to_i\ngamma = clamp(aleph - j, 0, 1)\na = sorted_values[j]\nb = sorted_values[j + 1]\na + ((b - a) * gamma)\n"}},{"id":"skew(values,corrected=false)-instance-method","html_id":"skew(values,corrected=false)-instance-method","name":"skew","doc":"Computes the skewness of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `corrected`: when set to `true`, then the calculations are corrected for statistical bias. Default is `false`.\n\nThis implementation is based on the [scipy/stats.py](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py#L1039).","summary":"
Computes the skewness of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"args_string":"(values, corrected = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L170","def":{"name":"skew","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"n = values.size\nm = mean(values)\nm3 = moment(values, m, 3)\nm2 = moment(values, m, 2)\ncorrection_factor = corrected ? (Math.sqrt((n - 1.0) * n)) / (n - 2.0) : 1\n(correction_factor * m3) / (m2 ** 1.5)\n"}},{"id":"std(values,mean=nil,corrected=false)-instance-method","html_id":"std(values,mean=nil,corrected=false)-instance-method","name":"std","doc":"Computes the standard deviation of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed `mean`. This could be a pre-computed sample's mean\n or the population's known mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `corrected`: when set to `true`, then the sum of squares is scaled\n with `values.size - 1`, rather than with `values.size`. Default is `false`.","summary":"
Computes the standard deviation of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"args_string":"(values, mean = nil, corrected = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L188","def":{"name":"std","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Math.sqrt(var(values, mean, corrected))"}},{"id":"var(values,mean=nil,corrected=false)-instance-method","html_id":"var(values,mean=nil,corrected=false)-instance-method","name":"var","doc":"Computes the variance of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed `mean`. This could be a pre-computed sample's mean\n or the population's known mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `corrected`: when set to `true`, then the sum of squares is scaled\n with `values.size - 1`, rather than with `values.size`. Default is `false`.","summary":"
see https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables https://www.johndcook.com/SimpleRNG.cpp https://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/
'
+ );
+
+ function handleShortkeys(event) {
+ var element = event.target || event.srcElement;
+
+ if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){
+ return;
+ }
+
+ switch(event.key) {
+ case "?":
+ usageModal.show();
+ break;
+
+ case "Escape":
+ usageModal.hide();
+ break;
+
+ case "s":
+ case "/":
+ if(usageModal.isVisible()) {
+ return;
+ }
+ event.stopPropagation();
+ navigator.focus();
+ performSearch();
+ break;
+ }
+ }
+
+ document.addEventListener('keyup', handleShortkeys);
+
+ var scrollToEntryFromLocationHash = function() {
+ var hash = window.location.hash;
+ if (hash) {
+ var targetAnchor = unescape(hash.substr(1));
+ var targetEl = document.querySelectorAll('.entry-detail[id="' + targetAnchor + '"]');
+
+ if (targetEl && targetEl.length > 0) {
+ targetEl[0].offsetParent.scrollTop = targetEl[0].offsetTop;
+ }
+ }
+ };
+ window.addEventListener("hashchange", scrollToEntryFromLocationHash, false);
+ scrollToEntryFromLocationHash();
+});
diff --git a/docs/search-index.js b/docs/search-index.js
new file mode 100644
index 0000000..5e09cac
--- /dev/null
+++ b/docs/search-index.js
@@ -0,0 +1 @@
+crystal_doc_search_index_callback({"repository_name":"github.com/lbarasti/statistics","body":"\n[](https://opensource.org/licenses/MIT)\n\n# statistics\n\nA statistical library to perform descriptive statistics and generate random values based on popular probability distributions.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n```yaml\ndependencies:\n statistics:\n github: lbarasti/statistics\n```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"statistics\"\n```\n\n### Descriptive statistics\nYou can compute mean, variance and standard deviation of a collection as follows.\n```crystal\ninclude Statistics\n\nx = [1, 10, 7]\nmean(x) # 6\nvar(x) # 14\nvar(x, corrected: true) # 21\nvar(x, mean: 8) # 18.0\nstd(x) # 3.7416...\n```\n\n### Sampling\nTo work with distributions, import the `Distributions` namespace as follows.\n```crystal\ninclude Statistics::Distributions\n```\n\nNow, here is how we sample values from a normal distribution with `mean = 1.5` and `std = 0.2`.\n```crystal\nNormal.new(1.5, 0.2).rand\n```\n\nWe can generate an iterable of normally distributed random values as follows.\n```crystal\ngen = Normal.new(1.5, 0.2)\n1000.times.map { gen.rand }\n```\n\n#### Supported distributions\nThe following distributions are supported:\n* Constant\n* Exponential\n* Normal\n* Poisson\n* Uniform\n\nDon't see your favourite one on the list? Just fork the repo, add your distribution to the `distributions.cr` file, and open a PR.\n\n## Development\n\nThis shard is a work in progress. Everyone's contribution is welcome.\n\nThe guiding principle at this stage is\n> make it work before you make it right\n\nWhich in this context means: let's not focus on benchmarks and performance, but rather on usability and correctness.\n\n## References\n* [numpy.random](https://numpy.org/devdocs/reference/random/generator.html): distributions and random sampling\n* [numpy statistics](https://numpy.org/devdocs/reference/routines.statistics.html#averages-and-variances): order statistics, averages and variances\n* [scipy stats](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py) module and related [tests](https://github.com/scipy/scipy/blob/1150c4c033899a5a4556b7d34d6b137352b36b9e/scipy/stats/tests/test_stats.py) tests\n* [julia random](https://docs.julialang.org/en/v1/stdlib/Random/) module\n* [julia statistics](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.std) module\n* [julia distributions](https://juliastats.org/Distributions.jl/latest/starting/) package.\n* on [skewness and kurtosis](https://brownmath.com/stat/shape.htm), by Stan Brown\n* more on [skewness and kurtosis](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm), from NIST.\n\n## Contributing\n\n1. Fork it ()\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [lbarasti](https://github.com/lbarasti) - creator and maintainer\n","program":{"html_id":"github.com/lbarasti/statistics/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[],"locations":[],"repository_name":"github.com/lbarasti/statistics","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"github.com/lbarasti/statistics/Statistics","path":"Statistics.html","kind":"module","full_name":"Statistics","name":"Statistics","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"lib/distributions.cr","line_number":1,"url":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr"},{"filename":"statistics.cr","line_number":6,"url":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr"}],"repository_name":"github.com/lbarasti/statistics","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"\"0.1.0\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[{"html_id":"github.com/lbarasti/statistics/Statistics","kind":"module","full_name":"Statistics","name":"Statistics"}],"subclasses":[],"including_types":[],"namespace":null,"doc":"Basic descriptive statistics functionality.\n\nMore flexible than a scientific-calculator, but not as exhaustive, yet.","summary":"
Basic descriptive statistics functionality.
","class_methods":[],"constructors":[],"instance_methods":[{"id":"describe(values)-instance-method","html_id":"describe(values)-instance-method","name":"describe","doc":"Computes several descriptive statistics of the passed array.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes several descriptive statistics of the passed array.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L14","def":{"name":"describe","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"size = values.size\nsorted = values.sort\n{mean: mean(values), var: var(values), std: std(values), skewness: skew(values), kurtosis: kurtosis(values), min: sorted.first, max: sorted.last, q1: quantile(sorted, 0.25, sorted: true), median: median(sorted, sorted: true), middle: middle(sorted), q3: quantile(sorted, 0.75, sorted: true)}\n"}},{"id":"frequency(values:Enumerable(T))forallT-instance-method","html_id":"frequency(values:Enumerable(T))forallT-instance-method","name":"frequency","doc":"Computes the number of occurrences of each value in the dataset.\n\nReturns a Hash with each the dataset values as keys and the number of times they appear as value.\n\nParameters\n- `values`: a one-dimensional dataset","summary":"
Computes the number of occurrences of each value in the dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable(T)"}],"args_string":"(values : Enumerable(T)) forall T","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L38","def":{"name":"frequency","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable(T)"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"values.reduce(Hash(T, Int32).new(0)) do |freq, v|\n __temp_24 = v\n freq[__temp_24] = freq[__temp_24] + 1\n freq\nend"}},{"id":"kurtosis(values,corrected=false,excess=false)-instance-method","html_id":"kurtosis(values,corrected=false,excess=false)-instance-method","name":"kurtosis","doc":"Computes the kurtosis of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `corrected`: when set to `true`, then the calculations are corrected for statistical bias. Default is `false`.\n- `excess`: when set to `true`, computes the [excess kurtosis](https://en.wikipedia.org/wiki/Kurtosis#Excess_kurtosis). Default is `false`.\n\nThis implementation is based on the [scipy/stats.py](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py#L1142).","summary":"
Computes the kurtosis of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""},{"name":"excess","doc":null,"default_value":"false","external_name":"excess","restriction":""}],"args_string":"(values, corrected = false, excess = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L53","def":{"name":"kurtosis","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""},{"name":"excess","doc":null,"default_value":"false","external_name":"excess","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"n = values.size\nm = mean(values)\nm4 = moment(values, m, 4)\nm2 = moment(values, m, 2)\nkurt = if corrected\n (((1 / (n - 2)) / (n - 3)) * (((((n ** 2) - 1) * m4) / (m2 ** 2)) - (3 * ((n - 1) ** 2)))) + 3\nelse\n m4 / (m2 ** 2)\nend\nexcess ? kurt - 3 : kurt\n"}},{"id":"mean(values)-instance-method","html_id":"mean(values)-instance-method","name":"mean","doc":"Computes the mean of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes the mean of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L72","def":{"name":"mean","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(values.reduce(0) do |acc, v|\n acc + v\nend) / values.size"}},{"id":"median(values,sorted=false)-instance-method","html_id":"median(values,sorted=false)-instance-method","name":"median","doc":"Computes the median of all elements in a dataset.\n\nFor an even number of elements the mean of the two median elements will be computed.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `sorted`: when `true`, the computations assume that the provided values are\n sorted. Default is `false`.\n\nSee Julia's [Statistics.median](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.median).","summary":"
Computes the median of all elements in a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"args_string":"(values, sorted = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L86","def":{"name":"median","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"size = values.size\nmid = size // 2\nsorted_values = sorted ? values : values.sort\nif size.odd?\n sorted_values[mid]\nelse\n middle([sorted_values[mid - 1], sorted_values[mid]])\nend\n"}},{"id":"middle(a,b)-instance-method","html_id":"middle(a,b)-instance-method","name":"middle","doc":"Computes the middle of two values `a` and `b`.","summary":"
Computes the middle of two values a and b.
","abstract":false,"args":[{"name":"a","doc":null,"default_value":"","external_name":"a","restriction":""},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":""}],"args_string":"(a, b)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L111","def":{"name":"middle","args":[{"name":"a","doc":null,"default_value":"","external_name":"a","restriction":""},{"name":"b","doc":null,"default_value":"","external_name":"b","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"0.5 * (a + b)"}},{"id":"middle(values)-instance-method","html_id":"middle(values)-instance-method","name":"middle","doc":"Computes the middle of an array `a`, which consists of finding its\nextrema and then computing their mean.\n\nParameters\n- `values`: a one-dimensional dataset.\n\nSee Julia's [Statistics.middle](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.middle).","summary":"
Computes the middle of an array a, which consists of finding its extrema and then computing their mean.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"args_string":"(values)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L105","def":{"name":"middle","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"min, max = values.minmax\nmiddle(min, max)\n"}},{"id":"mode(values:Enumerable)-instance-method","html_id":"mode(values:Enumerable)-instance-method","name":"mode","doc":"Computes the modal (most common) value in a dataset.\n\nReturns a pair with the modal value and the bin-count for the modal bin.\nIf there is more than one such value, no guarantees are made which one will be picked.\nNOTE: computing the mode requires traversing the entire dataset.\n\nParameters\n- `values`: a one-dimensional dataset.","summary":"
Computes the modal (most common) value in a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable"}],"args_string":"(values : Enumerable)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L123","def":{"name":"mode","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":"Enumerable"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(frequency(values)).max_by(&.last)"}},{"id":"moment(values,mean=nil,n=1)-instance-method","html_id":"moment(values,mean=nil,n=1)-instance-method","name":"moment","doc":"Calculates the n-th moment about the mean for a sample.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `n`: Order of central moment that is returned. Default is `1`.","summary":"
Calculates the n-th moment about the mean for a sample.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"n","doc":null,"default_value":"1","external_name":"n","restriction":""}],"args_string":"(values, mean = nil, n = 1)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L134","def":{"name":"moment","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"n","doc":null,"default_value":"1","external_name":"n","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"m = mean || (Statistics.mean(values))\n(values.reduce(0) do |a, b|\n a + ((b - m) ** n)\nend) / values.size\n"}},{"id":"quantile(values,p,sorted=false)-instance-method","html_id":"quantile(values,p,sorted=false)-instance-method","name":"quantile","doc":"Computes the quantile of a dataset at a specified probability `p` on the interval [0,1].\n\nQuantiles are computed via linear interpolation between the points `((k-1)/(n-1), v[k])`,\nfor `k = 1:n` where `n = values.size`.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `p`: probability. Values of `p` should be in the interval `[0, 1]`.\n- `sorted` indicates whether `values` can be assumed to be sorted.\n\nImplementation based on Julia's [Statistics.quantile](https://docs.julialang.org/en/v1/stdlib/Statistics/#Statistics.quantile).","summary":"
Computes the quantile of a dataset at a specified probability p on the interval [0,1].
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"p","doc":null,"default_value":"","external_name":"p","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"args_string":"(values, p, sorted = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L150","def":{"name":"quantile","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"p","doc":null,"default_value":"","external_name":"p","restriction":""},{"name":"sorted","doc":null,"default_value":"false","external_name":"sorted","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"sorted_values = sorted ? values : values.sort\nn = values.size\naleph = (n - 1) * p\nj = (clamp(aleph.floor, 0, n - 2)).to_i\ngamma = clamp(aleph - j, 0, 1)\na = sorted_values[j]\nb = sorted_values[j + 1]\na + ((b - a) * gamma)\n"}},{"id":"skew(values,corrected=false)-instance-method","html_id":"skew(values,corrected=false)-instance-method","name":"skew","doc":"Computes the skewness of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `corrected`: when set to `true`, then the calculations are corrected for statistical bias. Default is `false`.\n\nThis implementation is based on the [scipy/stats.py](https://github.com/scipy/scipy/blob/3de0d58/scipy/stats/stats.py#L1039).","summary":"
Computes the skewness of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"args_string":"(values, corrected = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L170","def":{"name":"skew","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"n = values.size\nm = mean(values)\nm3 = moment(values, m, 3)\nm2 = moment(values, m, 2)\ncorrection_factor = corrected ? (Math.sqrt((n - 1.0) * n)) / (n - 2.0) : 1\n(correction_factor * m3) / (m2 ** 1.5)\n"}},{"id":"std(values,mean=nil,corrected=false)-instance-method","html_id":"std(values,mean=nil,corrected=false)-instance-method","name":"std","doc":"Computes the standard deviation of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed `mean`. This could be a pre-computed sample's mean\n or the population's known mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `corrected`: when set to `true`, then the sum of squares is scaled\n with `values.size - 1`, rather than with `values.size`. Default is `false`.","summary":"
Computes the standard deviation of a dataset.
","abstract":false,"args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"args_string":"(values, mean = nil, corrected = false)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/statistics.cr#L188","def":{"name":"std","args":[{"name":"values","doc":null,"default_value":"","external_name":"values","restriction":""},{"name":"mean","doc":null,"default_value":"nil","external_name":"mean","restriction":""},{"name":"corrected","doc":null,"default_value":"false","external_name":"corrected","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Math.sqrt(var(values, mean, corrected))"}},{"id":"var(values,mean=nil,corrected=false)-instance-method","html_id":"var(values,mean=nil,corrected=false)-instance-method","name":"var","doc":"Computes the variance of a dataset.\n\nParameters\n- `values`: a one-dimensional dataset.\n- `mean`: a pre-computed `mean`. This could be a pre-computed sample's mean\n or the population's known mean. If a mean is not provided, then the sample's\n mean will be computed. Default is `nil`.\n- `corrected`: when set to `true`, then the sum of squares is scaled\n with `values.size - 1`, rather than with `values.size`. Default is `false`.","summary":"
see https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables https://www.johndcook.com/SimpleRNG.cpp https://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/
","abstract":false,"args":[{"name":"lambda","doc":null,"default_value":"","external_name":"lambda","restriction":"Float64"}],"args_string":"(lambda : Float64)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr#L38","def":{"name":"new","args":[{"name":"lambda","doc":null,"default_value":"","external_name":"lambda","restriction":"Float64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(lambda)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"rand-instance-method","html_id":"rand-instance-method","name":"rand","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr#L41","def":{"name":"rand","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"x = 0\np = Math.exp(-@lambda)\ns = p\nu = ::rand\nwhile u > s\n x = x + 1\n p = p * (@lambda / x)\n s = s + p\nend\nx\n"}}],"macros":[],"types":[]},{"html_id":"github.com/lbarasti/statistics/Statistics/Distributions/Uniform","path":"Statistics/Distributions/Uniform.html","kind":"class","full_name":"Statistics::Distributions::Uniform","name":"Uniform","abstract":false,"superclass":{"html_id":"github.com/lbarasti/statistics/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/lbarasti/statistics/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/lbarasti/statistics/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"lib/distributions.cr","line_number":55,"url":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr"}],"repository_name":"github.com/lbarasti/statistics","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/lbarasti/statistics/Statistics/Distributions","kind":"module","full_name":"Statistics::Distributions","name":"Distributions"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(min:Float64,max:Float64)-class-method","html_id":"new(min:Float64,max:Float64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"min","doc":null,"default_value":"","external_name":"min","restriction":"Float64"},{"name":"max","doc":null,"default_value":"","external_name":"max","restriction":"Float64"}],"args_string":"(min : Float64, max : Float64)","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr#L58","def":{"name":"new","args":[{"name":"min","doc":null,"default_value":"","external_name":"min","restriction":"Float64"},{"name":"max","doc":null,"default_value":"","external_name":"max","restriction":"Float64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(min, max)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"rand-instance-method","html_id":"rand-instance-method","name":"rand","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/lbarasti/statistics/blob/97da7c6c7422ab7208bdbf6822ef57ecd20dec27/src/lib/distributions.cr#L62","def":{"name":"rand","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@min + (::rand * @interval)"}}],"macros":[],"types":[]}]}]}]}})
\ No newline at end of file