我想为我班级的每个实例分配一个离散分布。也就是说,我想将分发用作私有成员变量。这可能吗?如何实施?
这是我试过的:
即
class Team // TEAM strategy
{
private:
int m_give; // the amount a team will give :: CONST VAR
int m_min_accept; // the minimum amount a team will accept :: CONST VAR
bool m_decline; // stores TRUE if previous round was REJECTION, and FALSE otherwise :: DYNAMIC VARIABLE
long m_sum; // stores the total amount of money the team has :: DYNAMIC VARIABLE
long m_sticker; // stores the total number of gold stickers aquired by a team: PUBLIC KNOWLEDGE!!!
int m_Dev; // a measure of honesty; is D = 0 => never lies, if D > 10 => lies a lot!
discrete_distribution<int> m_distribution;
等
答案 0 :(得分:1)
答案是肯定的。您可以将分发用作类的实例。上面使用的方法是正确的。
必须包括:
#include <random>