mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-06 17:43:27 +00:00

using this shell script: find src -type f -print0 | xargs -0 sed -i "s|Copyright (C) \([[:digit:]]*\)\([ ]*\)-\([ ]*\)2015|Copyright (C) \1\2-\32016|g"
48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
/*
|
|
Copyright (C) 2014 - 2016 by David White <dave@whitevine.net>
|
|
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY.
|
|
|
|
See the COPYING file for more details.
|
|
*/
|
|
#include "random_new_deterministic.hpp"
|
|
|
|
|
|
namespace random_new
|
|
{
|
|
|
|
rng_deterministic::rng_deterministic(rand_rng::mt_rng& gen)
|
|
: generator_(gen)
|
|
{
|
|
|
|
}
|
|
|
|
rng_deterministic::~rng_deterministic()
|
|
{
|
|
|
|
}
|
|
|
|
uint32_t rng_deterministic::next_random_impl()
|
|
{
|
|
return generator_.get_next_random();
|
|
}
|
|
|
|
|
|
set_random_determinstic::set_random_determinstic(rand_rng::mt_rng& rng)
|
|
: old_rng_(generator), new_rng_(rng)
|
|
{
|
|
generator = &new_rng_;
|
|
}
|
|
|
|
set_random_determinstic::~set_random_determinstic()
|
|
{
|
|
generator = old_rng_;
|
|
}
|
|
}
|