Page MenuHomeHEPForge

make_RNG.cc
No OneTemporary

Size
947 B
Referenced Files
None
Subscribers
None

make_RNG.cc

/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include "HEJ/make_RNG.hh"
#include <algorithm>
#include <locale>
#include "HEJ/Mixmax.hh"
#include "HEJ/Ranlux64.hh"
#include "HEJ/exceptions.hh"
namespace HEJ {
std::unique_ptr<RNG> make_RNG(
std::string const & name,
optional<std::string> const & seed
) {
std::string lname;
std::transform(
begin(name), end(name), std::back_inserter(lname),
[](char c) { return std::tolower(c, std::locale()); }
);
if(lname == "mixmax") {
if(seed) return std::make_unique<Mixmax>(std::stol(*seed));
return std::make_unique<Mixmax>();
}
if(lname == "ranlux64") {
if(seed) return std::make_unique<Ranlux64>(*seed);
return std::make_unique<Ranlux64>();
}
throw std::invalid_argument{"Unknown random number generator: " + name};
}
} // namespace HEJ

File Metadata

Mime Type
text/x-c
Expires
Tue, Sep 30, 4:44 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6553182
Default Alt Text
make_RNG.cc (947 B)

Event Timeline