Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
mock_vector.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
23#include <random>
24#include <vector>
25
26namespace shamalgs::primitives {
27
61 template<class T>
62 std::vector<T> mock_vector(u64 seed, u32 len, T min_bound, T max_bound) {
63 std::vector<T> vec;
64 vec.reserve(len);
65
66 std::mt19937 eng(seed);
67
68 for (u32 i = 0; i < len; i++) {
69 vec.push_back(mock_value(eng, min_bound, max_bound));
70 }
71
72 return vec;
73 }
74
99 template<class T>
100 inline std::vector<T> mock_vector(u64 seed, u32 len) {
102 return mock_vector(seed, len, Prop::get_min(), Prop::get_max());
103 }
104
105} // namespace shamalgs::primitives
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
T mock_value(Engine &eng, T min_bound, T max_bound)
Generates a random mock value within specified bounds.
std::vector< T > mock_vector(u64 seed, u32 len, T min_bound, T max_bound)
Generates a vector of random mock values within specified bounds.