Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_random_number_generator.cpp
Go to the documentation of this file.
1/*
2 * Created by Martin on 30/08/2017.
3 *
4 * Distributed under the Boost Software License, Version 1.0. (See accompanying
5 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 */
7
9#include "catch_context.h"
11
12namespace Catch {
13
14 std::mt19937& rng() {
15 static std::mt19937 s_rng;
16 return s_rng;
17 }
18
19 void seedRng( IConfig const& config ) {
20 if( config.rngSeed() != 0 ) {
21 std::srand( config.rngSeed() );
22 rng().seed( config.rngSeed() );
23 }
24 }
25
26 unsigned int rngSeed() {
27 return getCurrentContext().getConfig()->rngSeed();
28 }
29}
void seedRng(IConfig const &config)
IContext & getCurrentContext()
std::mt19937 & rng()
virtual IConfigPtr const & getConfig() const =0