名前空間
変種
操作

std::uniform_real_distribution

提供: cppreference.com
< cpp‎ | numeric‎ | random
2012年10月26日 (金) 07:00時点におけるTranslationBot (トーク | 投稿記録)による版

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)

 
 
 
擬似乱数生成
一様ランダムビットジェネレータ
エンジンとエンジンアダプタ
非決定的なジェネレータ
分布
一様分布
uniform_real_distribution
(C++11)
ベルヌーイ分布
ポアソン分布
正規分布
標本分布
シードシーケンス
(C++11)
C のライブラリ
 
 
ヘッダ <random> で定義
template< class RealType = double >
class uniform_real_distribution;
(C++11以上)
i、均一に間隔[a, b)で配布、それは、確率関数に応じて分配されているランダムな浮動小数点値を生成します
Original:
Produces random floating-point values i, uniformly distributed on the interval [a, b), that is, distributed according to the probability function:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
P(i|a,b) =
1
b − a
.

目次

メンバータイプ

 
メンバー·タイプ
Original:
Member type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
 
result_type RealType
 
param_type
不特定のパラメータセットのタイプ
Original:
the type of the parameter set, unspecified
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

メンバ関数

テンプレート:cpp/numeric/random/distribution/dcl list constructorテンプレート:cpp/numeric/random/distribution/dcl list resetテンプレート:cpp/numeric/random/distribution/dcl list operator()テンプレート:cpp/numeric/random/uniform real distribution/dcl list aテンプレート:cpp/numeric/random/uniform real distribution/dcl list bテンプレート:cpp/numeric/random/distribution/dcl list paramテンプレート:cpp/numeric/random/distribution/dcl list minテンプレート:cpp/numeric/random/distribution/dcl list max
世代
Original:
Generation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
特性
Original:
Characteristics
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

非メンバ関数

テンプレート:cpp/numeric/random/distribution/dcl list operator cmpテンプレート:cpp/numeric/random/distribution/dcl list operator ltltgtgt

1と2の間に10個の乱数を出力します
Original:
print 10 random numbers between 1 and 2
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <random>
#include <iostream>
 
int main()
{
    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_real_distribution<> dis(1, 2);
    for (int n = 0; n < 10; ++n) {
        std::cout << dis(gen) << ' ';
    }
    std::cout << '\n';
}

出力:

1.80829 1.15391 1.18483 1.38969 1.36094 1.0648 1.97798 1.27984 1.68261 1.57326