MathSample

配列要素からランダムサンプルを生成します。      

実数配列を扱うためのバージョン:                          

bool  MathSample(
  const double&  array[],          // 値の配列
  const int      count,            // カウント
  double&        result[]           // 結果の配列
  )

整数配列を扱うためのバージョン:                          

bool  MathSample(
  const int&    array[],          // 値の配列
  const int      count,            // カウント
  int&          result[]           // 結果の配列
  )

実数配列を扱うためのバージョン。サンプルは置き換えで得ることが可能です:                          

bool  MathSample(
  const double&  array[],          // 値の配列
  const int      count,            // カウント
  const bool    replace,          // フラグ
  double&        result[],          // 結果の配列
  )

整数配列を扱うためのバージョン:サンプルは置き換えで得ることが可能です:                          

bool  MathSample(
  const int&    array[],          // 値の配列
  const int      count,            // カウント
  const bool    replace,          // フラグ
  int&          result[]           // 結果の配列
  )

サンプリングの確率が定義されている実数配列を扱うためのバージョン:                          

bool  MathSample(
  const double&  array[],          // 値の配列
  double&        probabilities[]// 確率配列
  const int      count,            // カウント
  double&        result[]           // 結果の配列
  )

サンプリングの確率が定義されている整数配列を扱うためのバージョン:                          

bool  MathSample(
  const int&    array[],          // 値の配列
  double&        probabilities[]// 確率配列
  const int      count,            // カウント
  int&          result[]           // 結果の配列
  )

サンプリングの確率が定義されている実数配列を扱うためのバージョン:サンプルは置き換えで得ることが可能です:

bool  MathSample(
  const double&  array[],          // 値の配列
  double&        probabilities[]// 確率配列
  const int      count,            // カウント
  const bool    replace,          // フラグ
  double&        result[]           // 結果の配列
  )

サンプリングの確率が定義されている整数配列を扱うためのバージョン:サンプルは置き換えで得ることが可能です:

bool  MathSample(
  const int&    array[],          // 値の配列
  double&        probabilities[]// 確率配列
  const int      count,            // カウント
  const bool    replace,          // フラグ
  int&          result[]           // 結果の配列
  )

パラメータ

array[]

[in] 整数配列 

probabilities[]

[in] 要素をサンプルするための確率配列

count

[in] 要素数 

replace

[in]  置き換えによるサンプリングを可能にするパラメータ

result[]

[out] 結果を出力する配列.

戻り値

成功の場合は true、それ以外の場合は false。

注意事項

replace=true引数を使用すると、元のシーケンスに置き換えて元の要素を無作為抽出することができます。