Untitled
unknown
c_cpp
a year ago
546 B
11
Indexable
#pragma once
#include <random>
class RandomNumberGenerator
{
public:
explicit RandomNumberGenerator( unsigned int seed ) : rng( seed )
{
// Empty body.
}
int getRandomInt( int min, int max )
{
std::uniform_int_distribution< int > dist( min, max );
return dist( rng );
}
double getRandomReal( double min, double max )
{
std::uniform_real_distribution< double > dist( min, max );
return dist( rng );
}
private:
std::mt19937 rng;
};
Editor is loading...
Leave a Comment