std::generate_canonical
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
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.
You can help to correct and verify the translation. Click here for instructions.
十分なエントロピー、すなわち少なくともg()時間、場所を生成するために、必要に応じてmax(1, ⌈ min(b
1, b
2) / log
2 R ⌉)は何回も呼ばれています
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
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.
You can help to correct and verify the translation. Click here for instructions.
- b1 = std::numeric_limits<RealType>::digits
- b2 = std::numeric_limits<RealType>::bits
- R = g.max() - g.min() + 1.
目次 |
[編集] パラメータ
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.
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.
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.
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
[編集] も参照してください
(C++11) |
均等範囲に分散して実際の値を生成します Original: produces real values evenly distributed across a range The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |