diff --git a/reference/random.md b/reference/random.md index 3589ec9742..15257500b9 100644 --- a/reference/random.md +++ b/reference/random.md @@ -47,7 +47,7 @@ 先に挙げた擬似乱数生成器に対して一般的なパラメータを定義し、使いやすいように用意された擬似乱数生成器の型。 -これらの型には、パフォーマンス、オブジェクトのサイズ、周期などのトレードオフがある。ユーザーの目的に合わせて擬似乱数正器の型を選択してほしい。 +これらの型には、パフォーマンス、オブジェクトのサイズ、周期などのトレードオフがある。ユーザーの目的に合わせて擬似乱数生成器の型を選択してほしい。 オブジェクトのサイズをある程度無視・許容できる状況では、多くの分野と用途に、[`mt19937`](random/mt19937.md)を推奨できる。 @@ -84,7 +84,7 @@ ## 分布生成器 -分布生成器は、乱数生成器のよって生成される値の範囲や分布を調整するクラスである。 +分布生成器は、乱数生成器によって生成される値の範囲や分布を調整するクラスである。 分布生成器は、環境によって異なるアルゴリズムで実装される可能性がある。擬似乱数生成器は環境によらず同じシードを与えれば同じ乱数列が生成されるが、分布生成器を介して乱数生成する場合、環境によって異なる乱数列が生成される場合がある。 @@ -160,12 +160,12 @@ int main() std::mt19937 engine(seed_gen()); // 一様実数分布 - // [-1.0, 1.0)の値の範囲で、等確率に実数を生成する - std::uniform_real_distribution<> dist1(-1.0, 1.0); + // [-1.0f, 1.0f)の値の範囲で、等確率に実数を生成する + std::uniform_real_distribution dist1(-1.0f, 1.0f); // 正規分布 - // 平均1.0、標準偏差0.5で分布させる - std::normal_distribution<> dist2(1.0, 0.5); + // 平均1.0f、標準偏差0.5fで分布させる + std::normal_distribution dist2(1.0f, 0.5f); std::ofstream file("random.tsv"); for (size_t i = 0; i < 1000*1000; ++i) { diff --git a/reference/random/binomial_distribution.md b/reference/random/binomial_distribution.md index 9bf147b961..716eafc2a1 100644 --- a/reference/random/binomial_distribution.md +++ b/reference/random/binomial_distribution.md @@ -13,7 +13,7 @@ namespace std { ## 概要 `binomial_distribution`は、離散確率分布の一種である二項分布を表すクラスである。 -成功する確率pの事象をn回施行し、成功した回数を求める。 +成功する確率pの事象をn回試行し、成功した回数を求める。 二項分布は、以下のような用途に使用できる: @@ -82,7 +82,7 @@ int main() std::random_device seed_gen; std::default_random_engine engine(seed_gen()); - // 成功確率0.5の事象を5回施行する + // 成功確率0.5の事象を5回試行する std::binomial_distribution<> dist(5, 0.5); // 成功した回数を取得(0以上5以下の値が返される) diff --git a/reference/random/binomial_distribution/op_call.md b/reference/random/binomial_distribution/op_call.md index ae6793ca33..96871cdc94 100644 --- a/reference/random/binomial_distribution/op_call.md +++ b/reference/random/binomial_distribution/op_call.md @@ -38,7 +38,7 @@ int main() // (1) { - // 確率0.5で成功する事象を3回施行する + // 確率0.5で成功する事象を3回試行する std::binomial_distribution<> dist(3, 0.5); // 成功回数を取得 @@ -51,7 +51,7 @@ int main() using dist_type = std::binomial_distribution<>; dist_type dist; - // 確率0.5で成功する事象を3回施行する + // 確率0.5で成功する事象を3回試行する dist_type::param_type param(3, 0.5); // 成功回数を取得 diff --git a/reference/random/binomial_distribution/op_constructor.md b/reference/random/binomial_distribution/op_constructor.md index 3d02a43d29..c72284bb08 100644 --- a/reference/random/binomial_distribution/op_constructor.md +++ b/reference/random/binomial_distribution/op_constructor.md @@ -39,7 +39,7 @@ int main() // パラメータを個別に指定する { - // 確率0.5で成功する事象を、3回施行する + // 確率0.5で成功する事象を、3回試行する std::binomial_distribution<> dist(3, 0.5); // 成功回数を取得 @@ -51,7 +51,7 @@ int main() { using dist_type = std::binomial_distribution<>; - // 確率0.5で成功する事象を、3回施行する + // 確率0.5で成功する事象を、3回試行する dist_type::param_type param(3, 0.5); dist_type dist(param); diff --git a/reference/random/geometric_distribution.md b/reference/random/geometric_distribution.md index 6f9f7b4f2d..7350f757a3 100644 --- a/reference/random/geometric_distribution.md +++ b/reference/random/geometric_distribution.md @@ -13,9 +13,9 @@ namespace std { ## 概要 `geometric_distribution`は、離散確率分布の一種である幾何分布を表すクラスである。 -このクラスは、ベルヌーイ分布([`bernoulli_distribution`](bernoulli_distribution.md))を施行し、初めて成功するまでに何回失敗したかを取得する。これは、[`negative_binomial_distribution`](negative_binomial_distribution.md)`(1, p)`と同じである。 +このクラスは、ベルヌーイ分布([`bernoulli_distribution`](bernoulli_distribution.md))を試行し、初めて成功するまでに何回失敗したかを取得する。これは、[`negative_binomial_distribution`](negative_binomial_distribution.md)`(1, p)`と同じである。 -幾何分布は、無記憶性(memoryless)という性質を持つ。これにより、施行の結果が次の結果(確率)に影響せず、それぞれが独立した結果となる。 +幾何分布は、無記憶性(memoryless)という性質を持つ。これにより、試行の結果が次の結果(確率)に影響せず、それぞれが独立した結果となる。 幾何分布は、以下のような用途で使用できる: @@ -84,7 +84,7 @@ int main() std::random_device seed_gen; std::default_random_engine engine(seed_gen()); - // 成功確率0.5の事象を、成功するまで施行する + // 成功確率0.5の事象を、成功するまで試行する std::geometric_distribution<> dist(0.5); // 成功するまでに、何回失敗したかを取得 diff --git a/reference/random/geometric_distribution/op_call.md b/reference/random/geometric_distribution/op_call.md index 2bce05d9d4..14229bd5d1 100644 --- a/reference/random/geometric_distribution/op_call.md +++ b/reference/random/geometric_distribution/op_call.md @@ -38,7 +38,7 @@ int main() // (1) { - // 確率0.5で成功する事象を、成功するまで施行する + // 確率0.5で成功する事象を、成功するまで試行する std::geometric_distribution<> dist(0.5); // 成功するまでに失敗した回数を取得 @@ -51,7 +51,7 @@ int main() using dist_type = std::geometric_distribution<>; dist_type dist; - // 確率0.5で成功する事象を、成功するまで施行する + // 確率0.5で成功する事象を、成功するまで試行する dist_type::param_type param(0.5); // 成功するまでに失敗した回数を取得 diff --git a/reference/random/geometric_distribution/op_constructor.md b/reference/random/geometric_distribution/op_constructor.md index 95c0aadb9c..a83eab0385 100644 --- a/reference/random/geometric_distribution/op_constructor.md +++ b/reference/random/geometric_distribution/op_constructor.md @@ -39,7 +39,7 @@ int main() // (2) パラメータを個別に指定する { - // 確率0.5で成功する事象を、成功するまで施行する + // 確率0.5で成功する事象を、成功するまで試行する std::geometric_distribution<> dist(0.5); // 成功するまでに失敗した回数を取得 @@ -51,7 +51,7 @@ int main() { using dist_type = std::geometric_distribution<>; - // 確率0.5で成功する事象を、成功するまで施行する + // 確率0.5で成功する事象を、成功するまで試行する dist_type::param_type param(0.5); dist_type dist(param); diff --git a/reference/random/negative_binomial_distribution.md b/reference/random/negative_binomial_distribution.md index 3a101174a9..0dd417c262 100644 --- a/reference/random/negative_binomial_distribution.md +++ b/reference/random/negative_binomial_distribution.md @@ -13,10 +13,10 @@ namespace std { ## 概要 `negative_binomial_distribution`は、離散確率分布の一種である、負の二項分布を表すクラスである。 -二項分布([`binomial_distribution`](binomial_distribution.md)が「確率pで成功する事象をt回施行し、成功回数を取得する」のに対し、負の二項分布は「確率pで成功する事象がk回成功するまでに失敗した回数を取得する」ということを行う。 +二項分布([`binomial_distribution`](binomial_distribution.md)が「確率pで成功する事象をt回試行し、成功回数を取得する」のに対し、負の二項分布は「確率pで成功する事象がk回成功するまでに失敗した回数を取得する」ということを行う。 -負の二項分布は、実装によって「k回成功するまでに施行した回数を取得する」ものと、「k回成功するまでに失敗した回数を取得する」もの、2つのバリエーションが存在する。`std::negative_binomial_distribution`クラスは後者である。 +負の二項分布は、実装によって「k回成功するまでに試行した回数を取得する」ものと、「k回成功するまでに失敗した回数を取得する」もの、2つのバリエーションが存在する。`std::negative_binomial_distribution`クラスは後者である。 テンプレートパラメータは、以下を意味する: diff --git a/reference/random/poisson_distribution.md b/reference/random/poisson_distribution.md index 28d78815ac..505d9229a0 100644 --- a/reference/random/poisson_distribution.md +++ b/reference/random/poisson_distribution.md @@ -16,7 +16,7 @@ namespace std { `poisson_distribution`は、離散確率分布の一種であるポワソン分布を表すクラスである。 以下の確率密度関数に基いて、ランダムな整数を生成する: -$$ p(x \mid \mu) = \frac{e^{-\mu} \mu^i}{i!} $$ +$$ p(x \mid \mu) = \frac{e^{-\mu} \mu^x}{x!} $$ この数式においてμ(mu)は、平均値(mean)である。