If I generate random numbers with the following code:
#include <iostream>
#include <random>
int main()
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 999);
for (int n=0; n<1000; ++n)
std::cout << dis(gen) << ' ';
std::cout << '\n';
}
is it possible to get the previously generated values in the reverse order (without saving them into an array, etc...) after the loop is finished, and do something like this:
for (int n=0; n<1000; ++n)
std::cout << GetPrev(dis, gen) << ' ';
std::cout << '\n';
?
Aucun commentaire:
Enregistrer un commentaire