Randomize the food production in snakeGame

Viewed 40

I have tried to randomize the position of the food in the snakeGame with std::mt19937 but i can't quite get what to put as a parameter in snakeFood.setPosition()

Here is what i have for now, and it doesn't work.

        auto seed = std::chrono::high_resolution_clock::now().time_since_epoch().count();
        std::mt19937 mt_rand(seed);
        snakeFood.setSize(sf::Vector2f(5,5));
        snakeFood.setFillColor(sf::Color::Red);
        snakeFood.setPosition(seed, seed);

Thanks in advance.

0 Answers
Related