Log In  


Took me a while to debug and identify why this was happening...

I was taking advantage of RESET to clear clipping and palette and as a side-effect RND() started to misbehave returning always the exact same number. I guess that RESET also sets a fixed srand seed and that's why the pseudo-randoms go stale... Probably worth documenting that RESET also does that or if this was unintentional fix it...

3


Well, it’s annoying indeed. Maybe @zep would want to reconsider whether reset() should overwrite the PRNG memory area.


That definitely sounds like a bug to me.


Well it has an effect only if you are calling RESET regularly (I was doing that at the end of _draw() to clear out all my tampering...)


Yup it seems undocumented, but reset() reseeds. I called it on each new game state to clear clipping and palette tweaks.

> reset();for i=1,5 do print(rnd()) end


2

Oof -- yes, this was an unintended side-effect.
Fixed for 0.2.1c


1

Perfect! Thank you @zep



[Please log in to post a comment]