aboutsummaryrefslogtreecommitdiff
path: root/libcghEx.cpp
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-06 11:32:25 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-06 11:32:25 +0000
commitebdc44aea86a1fe7eace4dca91128675519171f6 (patch)
treec32b18dbd25abf530c2ffcca4e42cfa5eb28d54a /libcghEx.cpp
parentb3c3e0348f19125b5123d6f5c87e2cc91fd0172f (diff)
downloadbullet-lab-remix-ebdc44aea86a1fe7eace4dca91128675519171f6.tar.xz
New cgh interfage RandomEngine replacing rand(). Other small fixes.
Diffstat (limited to 'libcghEx.cpp')
-rw-r--r--libcghEx.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libcghEx.cpp b/libcghEx.cpp
index d228237..bea7341 100644
--- a/libcghEx.cpp
+++ b/libcghEx.cpp
@@ -6,6 +6,19 @@
#include <cstring>
//static const char* LIBCGH_SRC_FN="libcghEx.cpp";
+void RandomEngine::SetSeed(unsigned int seed){cseed=seed;}
+int RandomEngine::NextInt(int min,int max)
+{
+ if (min>max){int t=min;min=max;max=t;}
+ cseed*=214013;cseed+=2531011;
+ return min+(cseed^cseed>>15)%(max-min+1);
+}
+double RandomEngine::NextDouble(double min,double max)
+{
+ if (min>max){double t=min;min=max;max=t;}
+ cseed*=214013;cseed+=2531011;
+ return min+(cseed>>16)*(1.0f/65535.0f)*(max-min);
+}
void CircleIndicator::Init(double _r,double _thk,BYTE _a,bool _gr,HTEXTURE _Texture,TextureRect _TR,DWORD _cc)
{
circle=new hgeDistortionMesh(1025,3);