jeudi 30 avril 2020

can not return a variable of type "uniform_int_distribution

this is my code :

#include <iostream>
#include <random>

std::random_device rd;
std::mt19937 mt(rd());

std::uniform_int_distribution<int> RN(int min,int max)
{
std::uniform_int_distribution<int> dist(min,max);
return dist(mt);
}

int main()
{
std::cout << RN(1,100) << std::endl;
return 0;
}

so i have a problem that I get an error when trying to return dist my question is : why is it not working and how to fix it ?




Aucun commentaire:

Enregistrer un commentaire