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...

P#79357 2020-07-15 18:58

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

P#79414 2020-07-16 10:35
:: Mot

That definitely sounds like a bug to me.

P#79415 2020-07-16 11:44

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...)

P#79417 2020-07-16 14:01
:: wez

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

P#80123 2020-07-30 11:05
:: zep

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

P#80134 2020-07-30 19:21

Perfect! Thank you @zep

P#80136 2020-07-30 19:47

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-10-03 14:12:37 | 0.007s | Q:20