34 lines
710 B
C++
34 lines
710 B
C++
#include "generator.h"
|
|
#include "impl_generator.h"
|
|
#include "input_parsing.h"
|
|
#include "mersenne_generator.h"
|
|
#include "device_generator.h"
|
|
|
|
#include <memory>
|
|
|
|
|
|
Generator::Generator(const ProgramOptions& options): m_options{options}
|
|
{
|
|
if (m_options.seed != std::nullopt)
|
|
{
|
|
impl = std::make_unique<MersenneGenerator>(*m_options.seed, m_options.max_range,
|
|
m_options.num_entries);
|
|
}
|
|
else
|
|
{
|
|
impl= std::make_unique<DeviceGenerator>(m_options.max_range,
|
|
m_options.num_entries);
|
|
}
|
|
}
|
|
|
|
int Generator::get_next_num()
|
|
{
|
|
if (impl->has_more_numbers())
|
|
{
|
|
return impl->get_next_num();
|
|
}
|
|
else
|
|
{
|
|
return NO_MORE_NUMBERS;
|
|
}
|
|
} |