Oh so it adds the number for you. Well never mind then!
Assumed it was like the ones where YOU have to tell it what the seed it.
Should've known better. This is a scripting language, not the
other kind. Of course it works the way a sane person would have it work.
More TERRIBLE advice:
I would generate one random number for each option, add them together, and get the modulus.
If you need it to be EXACTLY FAIR.
Zero usually has half odds or no odds, and some of the higher numbers are 999 vs 1000 chances due to the whole bits thing.
Say you want to roll an imaginary dice out of a random number from 0-255 using mod 6.
Problems are you can't actually generate a zero (in the case of LFSRs and others).
And 255 isn't divisible by 6.
odds:
[1]...(mod = 1)...43 chances
[2]...(mod = 2)...43 chances
[3]...(mod = 3)...43 chances
[4]...(mod = 4)...
42 chances
[5]...(mod = 5)...
42 chances
[6]...(mod =
0)...
42 chances
That's not a huge problem but the margin of error is based on how many choices you have.
Some outcomes can have up to 50% less odds than others with enough choices.
Lua probably pulls out a random number from 1 to 2^32 though, so unless you have over 2^31 choices, I wouldn't sweat it.