Initial commit
This commit is contained in:
commit
4f4397b3e1
48 changed files with 2002 additions and 0 deletions
30
VectorFiller/atlas/generator/impl/RandomIntGenerator.h
Normal file
30
VectorFiller/atlas/generator/impl/RandomIntGenerator.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// -*- 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;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue