24 std::random_device rd;
25 std::mt19937 gen(rd());
26 std::normal_distribution<float> distribution(5.0, 2.0);
27 if (price_profile == 2) {
28 distribution.param(std::normal_distribution<float>::param_type(50.0, 20.0));
30 if (price_profile == 3) {
31 distribution.param(std::normal_distribution<float>::param_type(150.0, 50.0));
33 return std::abs(distribution(gen));
37 std::random_device rd;
38 std::mt19937 gen(rd());
41 std::normal_distribution<float> distribution(0, 0.5);
42 return std::abs(distribution(gen)) + 0.5;
48 std::random_device rd;
49 std::mt19937 gen(rd());
50 std::uniform_int_distribution<unsigned int> distribution(0, max_integer - 1);
51 return distribution(gen);
79 std::min(
static_cast<int>(rounds_passed / 3), 10) + temp;
82 std::min(
static_cast<int>(rounds_passed / 3), 10) - temp;
84 float zScoreUpLimit = (
upper_limit - trueMean) / trueSD;
85 float zScoreLowLimit = (
lower_limit - trueMean) / trueSD;
86 for (
int i = 0; i < 10; i++) {
87 if (zScoreLowLimit > 1.3) {
91 zScoreLowLimit = (
lower_limit - trueMean - 0.1) / trueSD;
93 if (zScoreUpLimit < -1.3) {
97 zScoreUpLimit = (
upper_limit - trueMean + 0.1) / trueSD;
101 if (lower_lim < -90) {
115 std::random_device rd;
116 std::mt19937 gen(rd());
118 std::normal_distribution<float> distribution(
123 for (
unsigned int max_loop = 0; max_loop < 100; max_loop++) {
124 float x = distribution(gen);
130 float stocastics[12] = {0.95507, -0.74162, 1.642, -0.94774, -0.80314, 1.7885,
131 -0.09846, 1.4693, 0.19288, -1.70222, 1.20933, -0.71088};
A class that represents a stock object in the game.
unsigned int get_split_count(void)
Get the split count of the stock.
float get_initial_price(void)
Get the initial price of the stock.
unsigned int get_history_size(void)
Get size of the history.
float get_total_attribute(stock_modifiers attribute)
Sums up get_base_attribute() and get_event_attribute().
float get_base_attribute(stock_modifiers attribute)
Get the base value of stock_attributes of the stock.
float get_price(void)
Get the price of the stock.
float get_event_attribute(stock_modifiers attribute)
Get the total change of attribute of the stock due to events only.
constexpr float meanMultiplier
Multiplier for mean.
const float sdMultiplier
Multiplier for standard deviation.
@ upper_limit
The upper limit of the stock price percentage change.
@ standard_deviation
Amount of variation of the stock price percentage change.
@ mean
The expectation of the stock price percentage change.
@ lower_limit
The lower limit of the stock price percentage change.
const float defaultUpperLimit
Default upper limit.
const float defaultLowerLimit
Default lower limit.
const float upperLimitMultiplier
Upper limit multiplier.
const float lowerLimitMultiplier
Lower limit multiplier.
float init_stock_price(int price_profile)
Initialize starting stock price.
float percentage_change_price(Stock stock)
Calculate the percentage change of the stock price.
std::map< stock_modifiers, float > getProcessedModifiers(Stock stock)
Get the processed modifiers for the stock.
unsigned int random_integer(unsigned int max_integer)
python randint like function
float init_sd(void)
Initialize the standard deviation of the stock price.
Header file for random related functions.