名前空間
変種
操作

std::generate_canonical

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

 
 
ニューメリックスライブラリ
一般的な数学関数
浮動小数点環境
複素数
数値配列
擬似乱数生成
コンパイル時有理数演算 (C++11)
汎用の数値演算
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota(C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
擬似乱数生成
エンジンとエンジンアダプタ
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.
linear_congruential_engine(C++11)
mersenne_twister_engine(C++11)
subtract_with_carry_engine(C++11)
discard_block_engine(C++11)
independent_bits_engine(C++11)
shuffle_order_engine(C++11)
ジェネレータ
Original:
Generators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
random_device(C++11)
ディストリビューション
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.
uniform_int_distribution(C++11)
uniform_real_distribution(C++11)
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.
bernoulli_distribution(C++11)
binomial_distribution(C++11)
negative_binomial_distribution(C++11)
geometric_distribution(C++11)
ポアソン分布
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.
poisson_distribution(C++11)
exponential_distribution(C++11)
gamma_distribution(C++11)
weibull_distribution(C++11)
extreme_value_distribution(C++11)
正規分布
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.
normal_distribution(C++11)
lognormal_distribution(C++11)
chi_squared_distribution(C++11)
cauchy_distribution(C++11)
fisher_f_distribution(C++11)
student_t_distribution(C++11)
サンプリング分布
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.
discrete_distribution(C++11)
piecewise_constant_distribution(C++11)
piecewise_linear_distribution(C++11)
シードシーケンス
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.
seed_seq(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.
rand
srand
RAND_MAX
 
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) << ' ';
    }
}

Output:

0.208143 0.824147 0.0278604 0.343183 0.0173263 0.864057 0.647037 0.539467 0.0583497 0.609219

[編集] も参照してください

均等範囲に分散して実際の値を生成します
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.

(クラステンプレート) [edit]