summaryrefslogtreecommitdiffstats
path: root/src/FastRandom.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-12-07 15:46:27 +0100
committerMattes D <github@xoft.cz>2014-12-07 15:46:27 +0100
commit3c3cb198f33fd55b9cb20188cc42034b21660d21 (patch)
tree282d86969d4a2cbad5a64a27d1e17a5bad8dbed6 /src/FastRandom.cpp
parentMerge pull request #1555 from mc-server/c++11 (diff)
downloadcuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.gz
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.bz2
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.lz
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.xz
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.tar.zst
cuberite-3c3cb198f33fd55b9cb20188cc42034b21660d21.zip
Diffstat (limited to '')
-rw-r--r--src/FastRandom.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/FastRandom.cpp b/src/FastRandom.cpp
index cfafc7486..515dc25ea 100644
--- a/src/FastRandom.cpp
+++ b/src/FastRandom.cpp
@@ -96,8 +96,8 @@ cFastRandom::cFastRandom(void) :
int cFastRandom::NextInt(int a_Range)
{
- m_IntDistribution = std::uniform_int_distribution<>(0, a_Range - 1);
- return m_IntDistribution(m_LinearRand);
+ std::uniform_int_distribution<> distribution(0, a_Range - 1);
+ return distribution(m_LinearRand);
}
@@ -108,8 +108,8 @@ int cFastRandom::NextInt(int a_Range)
int cFastRandom::NextInt(int a_Range, int a_Salt)
{
m_LinearRand.seed(a_Salt);
- m_IntDistribution = std::uniform_int_distribution<>(0, a_Range - 1);
- return m_IntDistribution(m_LinearRand);
+ std::uniform_int_distribution<> distribution(0, a_Range - 1);
+ return distribution(m_LinearRand);
}
@@ -119,8 +119,8 @@ int cFastRandom::NextInt(int a_Range, int a_Salt)
float cFastRandom::NextFloat(float a_Range)
{
- m_FloatDistribution = std::uniform_real_distribution<float>(0, a_Range - 1);
- return m_FloatDistribution(m_LinearRand);
+ std::uniform_real_distribution<float> distribution(0, a_Range);
+ return distribution(m_LinearRand);
}
@@ -131,8 +131,8 @@ float cFastRandom::NextFloat(float a_Range)
float cFastRandom::NextFloat(float a_Range, int a_Salt)
{
m_LinearRand.seed(a_Salt);
- m_FloatDistribution = std::uniform_real_distribution<float>(0, a_Range - 1);
- return m_FloatDistribution(m_LinearRand);
+ std::uniform_real_distribution<float> distribution(0, a_Range);
+ return distribution(m_LinearRand);
}
@@ -142,8 +142,8 @@ float cFastRandom::NextFloat(float a_Range, int a_Salt)
int cFastRandom::GenerateRandomInteger(int a_Begin, int a_End)
{
- m_IntDistribution = std::uniform_int_distribution<>(a_Begin, a_End - 1);
- return m_IntDistribution(m_LinearRand);
+ std::uniform_int_distribution<> distribution(a_Begin, a_End);
+ return distribution(m_LinearRand);
}
@@ -164,8 +164,8 @@ MTRand::MTRand() :
int MTRand::randInt(int a_Range)
{
- m_IntDistribution = std::uniform_int_distribution<>(0, a_Range);
- return m_IntDistribution(m_MersenneRand);
+ std::uniform_int_distribution<> distribution(0, a_Range);
+ return distribution(m_MersenneRand);
}
@@ -174,8 +174,8 @@ int MTRand::randInt(int a_Range)
int MTRand::randInt()
{
- m_IntDistribution = std::uniform_int_distribution<>(0, std::numeric_limits<int>::max());
- return m_IntDistribution(m_MersenneRand);
+ std::uniform_int_distribution<> distribution(0, std::numeric_limits<int>::max());
+ return distribution(m_MersenneRand);
}
@@ -184,8 +184,8 @@ int MTRand::randInt()
double MTRand::rand(double a_Range)
{
- m_DoubleDistribution = std::uniform_real_distribution<>(0, a_Range);
- return m_DoubleDistribution(m_MersenneRand);
+ std::uniform_real_distribution<> distribution(0, a_Range);
+ return distribution(m_MersenneRand);
}