mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 05:00:46 +00:00
b288d8a399
xorshift* PRNG This needs testing to ensure I didn't mess anything up switching function names around. Our PRNG sucks. This is probably obvious. I wish I had known better at the time I implemented it, but oh well. The replacement is an xorshift* PRNG variant with period 2^32 - 1 (meaning that the PRNG state will loop after four billion calls ... that's not likely to happen), versus the old PRNG's period of about 2^22 (?). The output is also much more random and less predictable; the old PRNG would fall into a predictable loop of output after about 4000 numbers were generated, which isn't much. The PRNG here also outputs numbers as fixed point from [0,1) (that's 0 to FRACUNIT-1, in other words) instead of single bytes at a time. This makes it much easier to calculate things for, say, P_RandomRange and P_RandomKey. A new macro, P_RandomChance(p), is now in use that returns true _p_ percent of the time, where _p_ is a fixed_t probability from 0 (0%) to FRACUNIT (100%). This doesn't affect netgames at all; the code for seed saving and restoring is identical (aside from a check to prevent seed being set to 0, which breaks xorshift PRNGs). Demos break, but A: _duh_ and B: they're already broken by all the changes to physics to accommodate slopes. P_Random is deprecated in Lua, as the function was renamed to P_RandomByte. Aside from that, nothing special. See merge request !64 |
||
---|---|---|
.. | ||
r_minigl | ||
r_opengl | ||
s_ds3d | ||
s_fmod | ||
s_openal | ||
hw3dsdrv.h | ||
hw3sound.c | ||
hw3sound.h | ||
hw_bsp.c | ||
hw_cache.c | ||
hw_data.h | ||
hw_defs.h | ||
hw_dll.h | ||
hw_draw.c | ||
hw_drv.h | ||
hw_glide.h | ||
hw_glob.h | ||
hw_light.c | ||
hw_light.h | ||
hw_main.c | ||
hw_main.h | ||
hw_md2.c | ||
hw_md2.h | ||
hw_trick.c | ||
hws_data.h |