I found that Boost has a non-deterministic RNG class, but it's syntax and utilization are eluding me. I'm attempting to write a wrapper class that has functions that return the dice rolls for an n-sided die, but I keep getting unresolved externals when I attempt to create or use a boost::random_device.
//Class Definition
class Dice_Bag {
boost::random_device RNG;
public:
int Roll_d3();
int Roll_d4();
int Roll_d6();
//etc.
private:
int Roll_die(int);
};
int Dice_Bag::Roll_die(int sides) {
return (RNG()%sides + 1);
}
...is my current attempt. I receive the following error when attempting to link:
Quote:
Dice_Bag.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall boost::random_device::operator()(void)" (??Rrandom_device@boost@@QAEIXZ) referenced in function "private: int __thiscall Dice_Bag::Roll_Die(int)" (?Roll_Die@Dice_Bag@@AAEHH@Z)
Where is my syntax going wrong? Other of the boost number generators are placed inside a distributor (like mt19937) and I've gotten that to work wonderfully; I don't want deterministic behavior if I can help it. Does boost::random_device need a distributor as well?
Any guidance would be greatly appreciated. Thank you!