Remove fast PRNG, it won't be necessary.
This commit is contained in:
parent
e4cadae5ef
commit
4c847db83d
2 changed files with 2 additions and 70 deletions
|
|
@ -1,3 +1,3 @@
|
|||
[default]
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1244 \cu(Mon Feb 2 14:31:59 CET 2026)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1244 \cu(2026-02-02 14:31:59)\c-";
|
||||
SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r1245 \cu(Mon Feb 23 16:18:38 CET 2026)\c-";
|
||||
SWWM_SHORTVER="\cw1.3pre r1245 \cu(2026-02-23 16:18:38)\c-";
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@ Struct SWWMProjectionData
|
|||
int viewx, viewy, vieww, viewh;
|
||||
}
|
||||
|
||||
Struct SWWMFRNGState
|
||||
{
|
||||
bool init;
|
||||
uint x, y, z, w, v, d;
|
||||
}
|
||||
|
||||
extend Class SWWMUtility
|
||||
{
|
||||
// cache some data that requires trig and quat math
|
||||
|
|
@ -450,68 +444,6 @@ extend Class SWWMUtility
|
|||
double yscale = dist*len;
|
||||
return angle, pitch, yscale;
|
||||
}
|
||||
|
||||
// XORWOW-based PRNG, the best and fastest we can really use in ZScript due to lack of 64-bit integers
|
||||
private static uint XORWOW( SWWMFRNGState &rss )
|
||||
{
|
||||
if ( !rss.init )
|
||||
{
|
||||
rss.x = 123456789;
|
||||
rss.y = 362436069;
|
||||
rss.z = 521288629;
|
||||
rss.w = 88675123;
|
||||
rss.v = 5783321;
|
||||
rss.d = 6615241;
|
||||
rss.init = true;
|
||||
}
|
||||
uint t = rss.v;
|
||||
uint s = rss.x;
|
||||
rss.v = rss.w;
|
||||
rss.w = rss.z;
|
||||
rss.z = rss.y;
|
||||
rss.y = s;
|
||||
t ^= t>>2;
|
||||
t ^= t<<1;
|
||||
t ^= s^(s<<4);
|
||||
rss.x = t;
|
||||
rss.d += 362437;
|
||||
return t+rss.d;
|
||||
}
|
||||
|
||||
// the public-callable functions
|
||||
static uint FastRand( SWWMFRNGState &rss, uint mod = 0 )
|
||||
{
|
||||
uint rslt = XORWOW(rss);
|
||||
if ( mod ) return rslt%mod;
|
||||
return rslt;
|
||||
}
|
||||
|
||||
static int FastRandRange( SWWMFRNGState &rss, int low, int high )
|
||||
{
|
||||
if ( low >= high ) ThrowAbortException("FastRandomRange called with low >= high");
|
||||
uint range = uint(high-low);
|
||||
int rslt = int(FastRand(rss,range));
|
||||
return low+rslt;
|
||||
}
|
||||
|
||||
static double FastFRand( SWWMFRNGState &rss )
|
||||
{
|
||||
uint rslt = XORWOW(rss);
|
||||
return rslt/double(uint.max);
|
||||
}
|
||||
|
||||
static Vector3 FastVRand( SWWMFRNGState &rss )
|
||||
{
|
||||
double ang = FastFRand(rss)*360;
|
||||
double pt = 90-FastFRand(rss)*180;
|
||||
return (cos(ang)*cos(pt),sin(ang)*cos(pt),-sin(pt));
|
||||
}
|
||||
|
||||
static Vector2 FastVRand2D( SWWMFRNGState &rss )
|
||||
{
|
||||
double ang = FastFRand(rss)*360;
|
||||
return (cos(ang),sin(ang));
|
||||
}
|
||||
}
|
||||
|
||||
// ultrafast PRNG for a bunch of UI stuff
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue