37 #include <thrust/random.h>
58 : min(1.f), max(0.f), rng(hash(msl::
getUniqueID())), dist(0.f, 1.f)
70 Rng(
float minVal,
float maxVal)
71 : min(minVal), max(maxVal), rng(hash(msl::
getUniqueID())), dist(minVal, maxVal)
84 Rng(
float minVal,
float maxVal,
size_t seed)
85 : min(minVal), max(maxVal), rng(seed), dist(minVal, maxVal)
103 thrust::default_random_engine rng;
104 thrust::uniform_real_distribution<float> dist;
106 std::default_random_engine rng;
107 std::uniform_real_distribution<float> dist;
111 size_t hash(
size_t a)
const
113 a = (a + 0x7ed55d16) + (a << 12);
114 a = (a ^ 0xc761c23c) ^ (a >> 19);
115 a = (a + 0x165667b1) + (a << 5);
116 a = (a + 0xd3a2646c) ^ (a << 9);
117 a = (a + 0xfd7046c5) + (a << 3);
118 a = (a ^ 0xb55a4f09) ^ (a >> 16);
MSL_USERFUNC size_t getUniqueID()
Returns a unique thread id.
Definition: muesli.h:278
MSL_USERFUNC Rng()
Default constructor.
Definition: rng.h:57
MSL_USERFUNC Rng(float minVal, float maxVal, size_t seed)
Creates a pseudo random number generator with minimum value minVal and maximum value maxVal and sets ...
Definition: rng.h:84
Class Rng represents a pseudo random number generator that can be called by both the CPU and the GPU...
Definition: rng.h:50
MSL_USERFUNC Rng(float minVal, float maxVal)
Creates a pseudo random number generator with minimum value minVal and maximum value maxVal...
Definition: rng.h:70
MSL_USERFUNC float operator()()
Definition: rng.h:95
Contains global definitions such as macros, functions, enums and classes, and constants in order to c...