std::uniform_real_distribution
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
ヘッダ <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.
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. |
メンバ関数
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. |
非メンバ関数
例
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.
You can help to correct and verify the translation. Click here for instructions.
Run this code
#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