uniform (離散)#
区間 [a, b) にわたって均一に分布する乱数を生成します。
説明#
uniform クラス・オブジェクトは、区間 [a, b) に均一に分布する乱数を生成するため generate 関数で使用されます。ここで、a、b はそれぞれ区間の左境界と右境界であり、\(a, b \in Z ; a < b\) です。
確率分布は次のように表されます。
累積分布関数は次のようになります。
API#
構文#
namespace oneapi::mkl::rng {
template<typename Method>
class uniform<std::(u)int32_t, Method> {
public:
using method_type = Method;
using result_type = std::(u)int32_t;
uniform(): uniform((std::(u)int32_t )(0),
std::is_same<Method,
uniform_method::standard>::value ? (1 << 23) :
std::numeric_limits<Type>::max()){}
explicit uniform(std::(u)int32_t a, std::(u)int32_t b);
explicit uniform(const param_type& pt);
std::(u)int32_t a() const;
std::(u)int32_t b() const;
param_type param() const;
void param(const param_type& pt);
};
}サポートされるデバイス: CPU と GPU。
インクルード・ファイル#
oneapi/mkl/rng.hpp
テンプレート・パラメーター#
|
生成メソッド。固有の値は次のとおりです:
配布テンプレート・パラメーター・メソッドのメソッドの説明を参照してください。 |
注
oneapi::mkl::rng::uniform_method::standard は、GPU デバイスで s BRNG タイプを使用します。これにより、\((abs(b – a) > 2^{23} || abs(b) > 2^{23} || abs(a) > 2^{23})\) の場合、生成された数値の統計が不正確になる可能性があります (丸め誤差のため)。この場合、適切な統計を取得するには oneapi::mkl::rng::uniform_method::accurate メソッドを使用します。
入力パラメーター#
名前 |
タイプ |
説明 |
|---|---|---|
|
|
左境界 |
|
|
右境界 |