summaryrefslogtreecommitdiff
path: root/loader/client/util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'loader/client/util.hpp')
-rw-r--r--loader/client/util.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/loader/client/util.hpp b/loader/client/util.hpp
new file mode 100644
index 0000000..aabfd69
--- /dev/null
+++ b/loader/client/util.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <windows.h>
+#include "strings.hpp"
+
+#include <random>
+
+namespace util
+{
+ namespace {
+ //make a random generator and seed it with a p random number
+ static std::random_device rd;
+ static std::mt19937 gen( rd( ) );
+ }
+
+ template < typename t >
+ __forceinline t random_number( t min, t max ) {
+ if constexpr( !std::is_integral_v< t > ) {
+ std::uniform_real_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ else {
+ std::uniform_int_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ }
+
+ // okay now this is epic
+ __forceinline void raise_error(const char *error) {
+ MessageBoxA(0, error, xors("error"), MB_ICONERROR);
+ ExitProcess(0);
+ }
+} \ No newline at end of file