summaryrefslogtreecommitdiff
path: root/common/GameUI/Random.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /common/GameUI/Random.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'common/GameUI/Random.h')
-rw-r--r--common/GameUI/Random.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/common/GameUI/Random.h b/common/GameUI/Random.h
new file mode 100644
index 0000000..90beb78
--- /dev/null
+++ b/common/GameUI/Random.h
@@ -0,0 +1,30 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Generalized 32-bit random number generator
+// Range is 0x00000000 - 0x7FFFFFFF
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef RANDOM_H
+#define RANDOM_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+// the random number seeding is automatic
+
+#define MAX_RANDOM_RANGE 0x7FFFFFFFUL
+
+// restarts random generator
+// setting lSeed to 0 causes the current time to be used as the seed
+// random number generator will automatically seed itself on first use with current time if this is not called
+extern void SeedRandomNumberGenerator(long lSeed = 0);
+
+// returns a random integer of range [low, high]
+extern long RandomLong( long lLow, long lHigh );
+
+// returns a random float of range [low, high)
+extern float RandomFloat( float flLow, float flHigh );
+
+#endif // RANDOM_H