MathSample
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, // flag
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 参数允许执行随机抽样元素替换回原序列。