Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19244637
make_RNG.cc
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
947 B
Referenced Files
None
Subscribers
None
make_RNG.cc
View Options
/**
* \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
Details
Attached
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)
Attached To
Mode
rHEJ HEJ
Attached
Detach File
Event Timeline
Log In to Comment