Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
951 B
C++
63 lines
951 B
C++
#include "../stdafx.h"
|
|
#include "Random.h"
|
|
|
|
namespace Math
|
|
{
|
|
|
|
RandomInt::RandomInt()
|
|
{
|
|
SetSeed(GetTickCount());
|
|
}
|
|
|
|
RandomInt::RandomInt(unsigned long seed) : random(seed)
|
|
{
|
|
}
|
|
|
|
void RandomInt::SetSeed(unsigned long seed)
|
|
{
|
|
random.SetSeed(seed);
|
|
}
|
|
|
|
unsigned int RandomInt::Next()
|
|
{
|
|
return random.Next();
|
|
}
|
|
|
|
unsigned int RandomInt::Next(unsigned int excludedMax)
|
|
{
|
|
if(excludedMax == 0)
|
|
return excludedMax;
|
|
|
|
return Next(0, excludedMax);
|
|
}
|
|
|
|
unsigned int RandomInt::Next(unsigned int includedMin, unsigned int excludedMax)
|
|
{
|
|
if(includedMin == excludedMax)
|
|
return includedMin;
|
|
|
|
return random.Next(includedMin, excludedMax);
|
|
}
|
|
|
|
|
|
RandomDouble::RandomDouble()
|
|
{
|
|
SetSeed(GetTickCount());
|
|
}
|
|
|
|
RandomDouble::RandomDouble(unsigned long seed) : random(seed)
|
|
{
|
|
}
|
|
|
|
void RandomDouble::SetSeed(unsigned long seed)
|
|
{
|
|
random.SetSeed(seed);
|
|
}
|
|
|
|
double RandomDouble::Next()
|
|
{
|
|
return random.Next();
|
|
}
|
|
|
|
|
|
}
|