名前空間
変種
操作

std::generate_canonical

提供: cppreference.com
< cpp‎ | numeric‎ | random

 
 
 
擬似乱数生成
エンジンとエンジンアダプタ
Original:
Engines and engine adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ジェネレータ
Original:
Generators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ディストリビューション
Original:
Distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
一様分布
Original:
Uniform distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
generate_canonical
(C++11)
ベルヌーイ分布
Original:
Bernoulli distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ポアソン分布
Original:
Poisson distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
正規分布
Original:
Normal distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
サンプリング分布
Original:
Sampling distributions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
シードシーケンス
Original:
Seed Sequences
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Cライブラリ
Original:
C library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
template< class RealType, size_t bits, class Generator >
RealType generate_canonical( Generator& g );
(C++11およびそれ以降)
範囲内のランダムな浮動小数点数[0; 1)を生成.
Original:
Generates a random floating point number in range [0; 1).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
十分なエントロピー、すなわち少なくともg()時間、場所を​​生成するために、必要に応じてmax(1, ⌈ min(b
1
, b
2
) / log
2
R ⌉)
は何回も呼ばれています
Original:
g() is called as many times as needed to generate enough entropy, i.e. at least max(1, ⌈ min(b
1
, b
2
) / log
2
R ⌉)
times, where
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

g -
エントロピーを取得するために使用する発電機
Original:
generator to use to acquire entropy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

範囲内の浮動小数点値[0; 1).
Original:
Floating point value in range [0; 1).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 例外

gによってスローされたものから除いてなし
Original:
None except from those thrown by g
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

偶発性の10ビットの乱数を生成します:これは1024の異なる値を生成することがあります
Original:
produce random numbers with 10 bits of randomness: this may produce only 1024 distinct values
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());
    for(int n=0; n<10; ++n) {
        std::cout << std::generate_canonical<double, 10>(gen) << ' ';
    }
}

出力:

0.208143 0.824147 0.0278604 0.343183 0.0173263 0.864057 0.647037 0.539467 0.0583497 0.609219

[編集] 参照

範囲内に一様に分布した実数値を生成します
(クラステンプレート) [edit]