LandSandBoat / server

:sailboat: LandSandBoat - a server emulator for Final Fantasy XI
https://landsandboat.github.io/server/
GNU General Public License v3.0
302 stars 608 forks source link

🔨 Lua: `math.random()` calls should always be bounded #6407

Open zach2good opened 2 weeks ago

zach2good commented 2 weeks ago

I affirm:

Describe the feature

Looking at this PR: https://github.com/LandSandBoat/server/pull/6406

I see we have 100 results for math.random() with no arguments, which returns a float between 0-1, which we typically are multiplying by 100 and then flooring.

We have 4 results for the regex: random\(\d\).

I think we should be using math.random(1, 100) in pretty much every case, unless we're picking from a container, matching onto stats, etc.