Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/mantaflow/helper/util/randomstream.h')
-rw-r--r--extern/mantaflow/helper/util/randomstream.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/extern/mantaflow/helper/util/randomstream.h b/extern/mantaflow/helper/util/randomstream.h
index 6c20ddc6a14..95e007fa943 100644
--- a/extern/mantaflow/helper/util/randomstream.h
+++ b/extern/mantaflow/helper/util/randomstream.h
@@ -270,7 +270,7 @@ inline void MTRand::seed()
}
// Was not successful, so use time() and clock() instead
- seed(hash(time(NULL), clock()));
+ seed(hash(time(nullptr), clock()));
}
inline void MTRand::initialize(const uint32 intseed)
@@ -377,19 +377,6 @@ class RandomStream {
}
/*! get a random number from the stream */
- inline double getDouble(void)
- {
- return mtr.rand();
- };
- inline float getFloat(void)
- {
- return (float)mtr.rand();
- };
-
- inline float getFloat(float min, float max)
- {
- return mtr.rand(max - min) + min;
- };
inline float getRandNorm(float mean, float var)
{
return mtr.randNorm(mean, var);
@@ -400,12 +387,20 @@ class RandomStream {
{
return getFloat();
}
+ inline Real getReal(float min, float max)
+ {
+ return getFloat(min, max);
+ }
#else
inline Real getReal()
{
return getDouble();
}
+ inline Real getReal(double min, double max)
+ {
+ return getDouble(min, max);
+ }
#endif
inline Vec3 getVec3()
@@ -422,6 +417,24 @@ class RandomStream {
private:
MTRand mtr;
+
+ inline double getDouble(void)
+ {
+ return mtr.rand();
+ };
+ inline float getFloat(void)
+ {
+ return (float)mtr.rand();
+ };
+
+ inline double getDouble(double min, double max)
+ {
+ return mtr.rand(max - min) + min;
+ };
+ inline float getFloat(float min, float max)
+ {
+ return (float)(mtr.rand(max - min) + min);
+ };
};
} // namespace Manta