Skip to content

Commit 90605cc

Browse files
committed
refactor: remove util from random namespace
1 parent 2b316b0 commit 90605cc

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

app/src/core/rand.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <core/logger/logger.hpp>
88

9-
namespace fastchess::util::random {
9+
namespace fastchess::random {
1010
inline std::mt19937_64 mersenne_rand;
1111

1212
inline uint64_t random_uint64() {
@@ -21,4 +21,4 @@ inline void seed(uint64_t seed) {
2121
LOG_INFO("Setting seed to: {}", seed);
2222
mersenne_rand.seed(seed);
2323
}
24-
} // namespace fastchess::util::random
24+
} // namespace fastchess::random

app/src/game/book/opening_book.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct Openings {
2020
template <typename T>
2121
static void shuffle(T& vec) {
2222
for (std::size_t i = 0; i + 2 <= vec.size(); i++) {
23-
auto rand = util::random::mersenne_rand();
23+
auto rand = random::mersenne_rand();
2424
std::size_t j = i + (rand % (vec.size() - i));
2525
std::swap(vec[i], vec[j]);
2626
}

app/src/matchmaking/tournament/tournament_manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void TournamentManager::start(const cli::Args& args) {
3838

3939
LOG_INFO("{}", cli::OptionsParser::Version);
4040

41-
util::random::seed(config::TournamentConfig->seed);
41+
random::seed(config::TournamentConfig->seed);
4242

4343
if (config::TournamentConfig->tb_adjudication.enabled) {
4444
LOG_INFO("Loading Syzygy tablebases...");

app/src/types/tournament.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct Tournament {
5353
bool report_penta = true;
5454
#endif
5555

56-
uint64_t seed = util::random::random_uint64();
56+
uint64_t seed = random::random_uint64();
5757

5858
int scoreinterval = 1;
5959

app/tests/opening_test.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ TEST_SUITE("Opening Book Test") {
167167
tournament.opening.start = 3256;
168168
tournament.seed = 123456789;
169169

170-
util::random::seed(tournament.seed);
170+
random::seed(tournament.seed);
171171

172172
auto book = book::OpeningBook(tournament);
173173
auto id = book.fetchId();
@@ -192,7 +192,7 @@ TEST_SUITE("Opening Book Test") {
192192
tournament.opening.start = 3256;
193193
tournament.seed = 123456789;
194194

195-
util::random::seed(tournament.seed);
195+
random::seed(tournament.seed);
196196

197197
auto book = book::OpeningBook(tournament);
198198
auto id = book.fetchId();
@@ -223,7 +223,7 @@ TEST_SUITE("Opening Book Test") {
223223
tournament.opening.start = 3256;
224224
tournament.seed = 123456789;
225225

226-
util::random::seed(tournament.seed);
226+
random::seed(tournament.seed);
227227

228228
auto book = book::OpeningBook(tournament);
229229
auto id = book.fetchId();

0 commit comments

Comments
 (0)