Exemple #1
0
int main() 
{
    for (int i = 0; i < 20; ++i)
    {
        std::cout << mainRandomGenerator.getRandom(0, 1) << " ";
    }
    std::cout << std::endl;
        
    for (int i = 0; i < 20; ++i)
    {
        std::cout << mainRandomGenerator.getRandom(0.2f, 0.2f) << " ";
    }
    std::cout << std::endl;
    
    for (int i = 0; i < 20; ++i)
    {
        std::cout << getInt(0, 10) << " ";
    }
    std::cout << std::endl;
    
    for (int i = 0; i < 20; ++i)
    {
        std::cout << getFloat(0.0f, 1.0f) << " ";
    }
    std::cout << std::endl;
    
    std::cout << getString(100) << std::endl;
}
Exemple #2
0
Enemy::Enemy(int lvl) : EnemyBase()
{
	level = lvl;
	RandomGenerator rg = RandomGenerator();
	name = EnemyName[rg.getRandom(0,5)];
	state = EnemyState[rg.getRandom(0, 5)];
	health = rg.getRandom(2, 6);
	alive = true;
}
Exemple #3
0
int getInt(int min, int max)
{
#ifdef HYDRA_FAKE_RANDOM_INT
    return HYDRA_FAKE_RANDOM_INT;
#else
    return mainRandomGenerator.getRandom(min, max);
#endif
}
Exemple #4
0
Room::Room()
{
	Boss endBoss = Boss(10);
	RandomGenerator rg = RandomGenerator();
	size = RoomSize[rg.getRandom(0, 2)];
	content = RoomContent[rg.getRandom(0, 3)];
	description = RoomDescription[rg.getRandom(0, 3)];
	appearance = RoomAppearance[rg.getRandom(0, 3)];
	lighting = RoomLighting[rg.getRandom(0,3)];
	connected[RoomDirection::NORTH] =  nullptr;
	connected[RoomDirection::EAST] = nullptr;
	connected[RoomDirection::SOUTH] = nullptr;
	connected[RoomDirection::WEST] = nullptr;
	visited = false;
	visiting = false;
	exit = false;
	equipment.push_back(Equipment());
}
Exemple #5
0
Warp::Warp(int width, int height, float persistence, int scale, RandomGenerator& rng) {
    _width = width;
    _height = height;
    _persistence = persistence;
    _scale = scale;

    for(int i = 0; i < 256; i += 1) {
        _rnd[i] = rng.getRandom() % 255;
    }

    for(int i = 0; i < 256; i += 1) {
        _grads[i] = Vec2(rng.getUniform(), rng.getUniform()).normalize();
    }
}
Exemple #6
0
float getFloat(float min, float max)
{
#ifdef HYDRA_FAKE_RANDOM_FLOAT
    return HYDRA_FAKE_RANDOM_FLOAT;
#else
    if(min == max)
    {
        return min;
    }
    
    if(min > max)
    {
        std::swap(min, max);
    }
    
    return mainRandomGenerator.getRandom(min, max);
#endif
}
Exemple #7
0
Room::Room(int room)
{
	number = room;
	Boss endBoss = Boss(10);
	RandomGenerator rg;
	size = RoomSize[rg.getRandom(0, 2)];
	content = RoomContent[rg.getRandom(0, 3)];
	description = RoomDescription[rg.getRandom(0, 3)];
	appearance = RoomAppearance[rg.getRandom(0, 3)];
	lighting = RoomLighting[rg.getRandom(0, 3)];
	color = RoomColor[rg.getRandom(0, 3)];
	connected[RoomDirection::NORTH] = nullptr;
	connected[RoomDirection::EAST] = nullptr;
	connected[RoomDirection::SOUTH] = nullptr;
	connected[RoomDirection::WEST] = nullptr;
	visited = false;
	visiting = false;
	exit = false;
	equipment.push_back(Equipment());
	if (rg.getRandom(0, 100) < 20)
		traps.push_back(Trap());
}
Exemple #8
0
int Player::doAttack()
{
	RandomGenerator rg;
	int retunVal = rg.getRandom( 0, getAttack());
	return retunVal;
}