16 Commits

Author SHA1 Message Date
Shauren
2c74626e66 Core/Random: Use standard aligned operator new and remove RandomEngine singleton instance (it is trivially constructible) 2025-07-09 12:20:10 +02:00
Shauren
9894f6b802 Core/Random: Changed random functions returning doubles to return floats
* They were all cast to float at use anyway
* Improves roll_chance_f performance (rand32() is now called internally by uniform_real_distribution once instead of twice)
2023-10-31 20:20:00 +01:00
Giacomo Pozzoni
509a70f57f Core/Threads: Replace Boost TLS with C++11 one (#15782)
* Core/Threads: Replace Boost TLS with C++11 one

Replace boost::thread_specific_ptr<T> thread-local storage with C++11 thread_local to remove libboost_thread dependency from common project

* Fix no-pch build

(cherry picked from commit 00b16992f1)
2022-01-23 22:16:45 +01:00
Shauren
b93bf95f2e Core/Random: Refactor random number generation to use std::uniform_*_distribution to restrict result range instead of doing that ourselves
* Seed SFMTRand with more values for its state

(cherry picked from commit 73bc3d8ea4)
2021-12-19 00:13:11 +01:00
daMaex
08b40733a5 Dep/SFMT: updated to newest upstream version from https://github.com/MersenneTwister-Lab/SFMT
* only needed files added
* used CMake and SFMTRand from https://github.com/TrinityCore/TrinityCore/pull/23240 (Thank you Artox)

(cherry picked from commit 4e0279b0e4)
2021-12-19 00:12:41 +01:00
Treeston
3418a33a87 Misc: Pass std::chrono types by value everywhere.
(cherry picked from commit 2ef9d301f0)
2021-10-14 19:39:42 +02:00
Aokromes
b0bf1275ee New Year 2020-01-02 06:44:10 +01:00
vincent-michael
5620eb9463 Update copyright note for 2019
auto happy = new year(2019);
2019-01-01 10:14:33 +01:00
vincent-michael
7d00ae4045 Update copyright note for 2018
auto happy = new year(2018);
2018-01-01 00:40:17 +01:00
Shauren
4226eb2ea5 Core/Misc: Some /W4 warning fixes 2017-06-07 17:23:50 +02:00
Shauren
3a418a0bbc Core/Common: Include cleanup 2017-05-11 22:29:51 +02:00
Shauren
a1e3b54e07 Core/Utils: Changed all Trinity::Containers utilities to work on all container types (including arrays where it makes sense)
* Added MapGetValuePtr to allow writing `if (Val* v = MapGetValuePtr(map, key))`
* Added utility IteratorPair class with begin/end methods and MapEqualRange for use in range for syntax with multimaps
2017-03-21 21:04:01 +01:00
vincent-michael
86b98686a9 Update copyright note for 2017
Happy new year
2017-01-01 16:23:13 +01:00
treeston
cf7436b644 Util/Random: Add randtime(Milliseconds const&, Milliseconds const&) to supersede urandms(uint32,uint32) for scripts being ported to std::chrono.
(cherry picked from commit 224b42c53a)
2016-04-08 22:57:01 +02:00
Vincent-Michael
478cc756eb Update copyright note for 2016
Happy new year (Again new year with idiots ...)
2016-01-01 00:34:25 +01:00
Shauren
ae20b2ab56 Core/Utils: Moved rng functions to separate header and added utility functions to select a random element from a container where each element can have different chance of being selected 2015-12-24 19:48:39 +01:00