Page 1 of 1

Random generator behaviour

Posted: Sun Apr 30, 2017 10:21 pm
by orzelek
I've been playing around with replacing custom rng in RSO for new built in one. I didn't measure it but by looking at time stats it's also faster then lua one by quite a bit. Determinism also tested nicely - can regen ore exactly as before.

It seems to work very well with one small inconsistency.
If I have line like this:

Code: Select all

			shape = meta_shapes[rng(1,#meta_shapes)]
I would add 1 to amount of entries in table since docs state that rng is [low, high) but it would then fail on accessing a nil in the table.
In practice rolled value is [low, high] so it works as it should without +1 there. It's actually better for me this way but then docs could use an update.

Can you take a look and amend docs or code to make it consistent?

Re: Random generator behaviour

Posted: Mon May 01, 2017 4:04 pm
by Rseding91
Thanks for the notice. I'll update the lua docs.