clean-code/VectorFiller/atlas/generator/impl/RandomIntGenerator.h

30 lines
489 B
C++

// -*- mode: c++ -*-
#pragma once
#include "../generator.h"
#include <random>
namespace atlas::generator {
class RandomIntGenerator : public Generator<int> {
public:
RandomIntGenerator()
: RandomIntGenerator(rand())
{
}
RandomIntGenerator(int const seed)
: m_device(seed)
{
}
auto next() -> value_type override
{
return m_gen(m_device);
}
private:
std::mt19937 m_device;
std::uniform_int_distribution<> m_gen;
};
}