mirror of
https://github.com/BishopFox/untwister.git
synced 2026-11-07 10:35:58 -10:00
34 lines
695 B
C++
34 lines
695 B
C++
/*
|
|
* PRNGFactory.cpp
|
|
*
|
|
* Created on: Feb 19, 2014
|
|
* Author: moloch
|
|
*/
|
|
|
|
#include "PRNGFactory.h"
|
|
|
|
PRNGFactory::PRNGFactory()
|
|
{
|
|
library[GLIBC_RAND] = &create<GlibcRand>;
|
|
library[MT19937] = &create<Mt19937>;
|
|
library[RUBY_RAND] = &create<Ruby>;
|
|
}
|
|
|
|
PRNGFactory::~PRNGFactory() {}
|
|
|
|
PRNG* PRNGFactory::getInstance(std::string name)
|
|
{
|
|
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
|
return library[name]();
|
|
}
|
|
|
|
std::vector<std::string> PRNGFactory::getNames()
|
|
{
|
|
std::vector<std::string> names;
|
|
for (PRNGLibrary::iterator iter = library.begin(); iter != library.end(); ++iter)
|
|
{
|
|
names.push_back(iter->first);
|
|
}
|
|
return names;
|
|
}
|