diff options
| author | Martin Hořeňovský | 2022-08-18 21:22:28 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-08-18 23:23:18 +0200 |
| commit | dc001fa935d71b4b77f263fce405c9dbdfcbfe28 (patch) | |
| tree | 829c8fc1837022b64b56d06e24df95b4ff4f3b0c /src/catch2/catch_get_random_seed.cpp | |
| parent | 33e70194d32b8eb487b2f882b94353e0aed662cf (diff) | |
| download | catch3-dc001fa935d71b4b77f263fce405c9dbdfcbfe28.tar.gz | |
Allow easy retrieval of RNG seed by the users
This makes it so that they don't need parallel RNG seed passing
infrastructure for randomized data generation (e.g. inputs for
benchmarks).
Diffstat (limited to 'src/catch2/catch_get_random_seed.cpp')
| -rw-r--r-- | src/catch2/catch_get_random_seed.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/catch2/catch_get_random_seed.cpp b/src/catch2/catch_get_random_seed.cpp new file mode 100644 index 00000000..12a5b6d8 --- /dev/null +++ b/src/catch2/catch_get_random_seed.cpp @@ -0,0 +1,18 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 + +#include <catch2/catch_get_random_seed.hpp> + +#include <catch2/internal/catch_context.hpp> +#include <catch2/catch_config.hpp> + +namespace Catch { + std::uint32_t getSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } +} |