Toggle navigation
ivorium
iv_components
Example project
GitHub
Main Page
Modules
Classes
Files
File List
File Members
ivorium_systems
RandomSystem
RandomGenerator.inl
Go to the documentation of this file.
1
namespace
iv
2
{
3
4
template
<
class
T >
5
RandomGenerator::RandomGenerator
(
Instance
* inst,
RandomId
id
, T
const
& identity ) :
6
inst( inst )
7
{
8
// get basic seed
9
uint_fast32_t seed = 0;
10
if
(
auto
rs = this->
instance
()->getSystem< RandomSystem >() )
11
seed = rs->seed(
id
);
12
13
// combine seed with identity
14
this->identity_seed =
iv::hash< std::pair< uint_fast32_t, T >
>()( std::pair< uint_fast32_t, T >( seed, identity ) );
15
16
// seed
17
this->
reset
();
18
}
19
20
}