#include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath> 
#include <random>


std::mt19937& GetRand()
{
	std::random_device rd;
    std::mt19937 gen(rd());
	return gen;
}

template <typename T>
T Draw(T lo, T hi)
{
	if (lo == hi)
		return lo;

	if (hi < lo)
		std::swap(lo, hi);

	std::uniform_int_distribution<T> d(lo, hi);
	return d(GetRand());
}

template <typename T>
T GaussNormal(T lo, T hi)
{
	if (lo == hi)
		return lo;

	if (hi < lo)
		std::swap(lo, hi);

	std::normal_distribution<T> d(lo, hi);
	return d(GetRand());
}

int MINMAX(int min, int value, int max)
{
    register int tv;
 
    tv = (min > value ? min : value);
    return (max < tv) ? max : tv;
}
 

int main()
{
    int iSkillBonus, iNormalHitBonus;
    unsigned long long counter = 0;

    for (;;)
    {
        iSkillBonus = MINMAX(-30, (GaussNormal(0.0f, 5.0f) + 0.5f), 30);
        if (abs(iSkillBonus) <= 20)
            iNormalHitBonus = -2 * iSkillBonus + abs(Draw(-8, 8) + Draw(-8, 8)) + Draw(1, 4);
        else
            iNormalHitBonus = -2 * iSkillBonus + Draw(1, 5);
   
        counter += 1;
        if (iNormalHitBonus >= 58) ////if normal hit bonus is 55 or higher, the loop will stop
            break;
   

 
        //you can delete this if you want to make it faster
        //cout << "normal hit bonus: " << iNormalHitBonus << endl;
        //cout << "skill bonus: " << iSkillBonus << endl;
        //
 
    }
 
    std::cout << "you've used " << counter << " changes" << std::endl;
 
    return 0;
}