Mam klasę z metodą statyczną getRandomValue(**int **minVal, **int **maxVal) którą wywołuję w main.cpp:
RandomGenerator::getRandomValue(0, 10);
Niestety co wywołanie, losowana jest ta sama liczba, co jest nie tak?
#include "RandomGenerator.h"
#include <random>
#include <ctime>
RandomGenerator::RandomGenerator() {}
RandomGenerator::~RandomGenerator() {}
void RandomGenerator::init() {}
int RandomGenerator::getRandomValue(int minVal, int maxVal) {
int val = 0;
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dist(minVal, maxVal);
val = dist(gen);
return val;
}