32#include "common/PxPhysXCommonConfig.h"
33#define TEST_MAX_RAND 0xffff
47 PxU32 randomize() { mRnd = mRnd * 2147001325 + 715136305;
return mRnd; }
52 PxF32 rand(PxF32 a, PxF32 b)
54 const PxF32 r = rand32() / (
static_cast<PxF32
>(0xffffffff));
55 return r * (b - a) + a;
58 PxI32 rand(PxI32 a, PxI32 b)
60 return a +
static_cast<PxI32
>(rand32() % (b - a));
65 return rand() / (
static_cast<PxF32
>(0xffff)) - 0.5f;
69 return rand32() / (
static_cast<PxF32
>(0xffffffff)) - 0.5f;
72 PxF32 randomFloat32(PxReal a, PxReal b) {
return rand32() / PxF32(0xffffffff)*(b - a) + a; }
133 void setSeed(PxI32 s)
139 for (j = 0; j < 250; j++)
140 mBuffer[j] = lcg.randomize();
142 for (j = 0; j < 250; j++)
143 if (lcg.randomize() > 0x40000000L)
144 mBuffer[j] |= 0x80000000L;
146 PxU32 msb = 0x80000000;
147 PxU32 mask = 0xffffffff;
149 for (j = 0; j < 32; j++)
151 const PxI32 k = 7 * j + 3;
164 if (mIndex >= 147) j = mIndex - 147;
165 else j = mIndex + 103;
167 const PxU32 new_rand = mBuffer[mIndex] ^ mBuffer[j];
168 mBuffer[mIndex] = new_rand;
171 if (mIndex >= 249) mIndex = 0;
174 return new_rand >> 1;
179 PxU32 mask = (1 << 23) - 1;
180 return PxF32(randI()&(mask)) / PxF32(mask);
183 PxReal rand(PxReal lower, PxReal upper)
185 return lower + randUnit() * (upper - lower);
197 return gRandomR250.randI() & TEST_MAX_RAND;
202 const PxF32 r =
static_cast<PxF32
>(Rand()) / (
static_cast<PxF32
>(TEST_MAX_RAND));
203 return r * (b - a) + a;
207 const PxF32 r =
static_cast<PxF32
>(Rand()) / (
static_cast<PxF32
>(0x7fff) + 1.0f);
208 return r * (b - a) + a;
213 return a +
static_cast<PxI32
>(Rand() % (b - a));
218 gRandomR250.setSeed(seed);
Definition CmRandom.h:126
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition PxQuat.h:50
float x
Definition PxQuat.h:395
PX_CUDA_CALLABLE PX_INLINE float normalize()
maps to the closest unit quaternion.
Definition PxQuat.h:227
3 Element vector class.
Definition PxVec3.h:50
PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize()
normalizes the vector in place
Definition PxVec3.h:300
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39