eq2emu/docs/lua_functions/MakeRandomInt.md

18 lines
480 B
Markdown
Raw Permalink Normal View History

2025-05-28 21:48:33 -04:00
### Function: MakeRandomInt(Min, Max)
2025-05-04 14:34:15 -04:00
2025-05-28 21:48:33 -04:00
**Description:** Generates a random integer between the specified minimum and maximum values (inclusive).
2025-05-04 14:34:15 -04:00
2025-05-28 21:48:33 -04:00
**Parameters:**
2025-05-04 14:34:15 -04:00
2025-05-28 21:48:33 -04:00
`Min`: Int32 The minimum value.
`Max`: Int32 The maximum value.
2025-05-04 14:34:15 -04:00
2025-05-28 21:48:33 -04:00
**Returns:** Int32 A random integer N where Min ≤ N ≤ Max.
2025-05-04 14:34:15 -04:00
2025-05-28 21:48:33 -04:00
**Example:**
2025-05-15 09:50:31 -04:00
2025-05-28 21:48:33 -04:00
```lua
2025-05-15 09:50:31 -04:00
-- Example usage (roll a random amount of coin to reward)
local reward = MakeRandomInt(100, 500) -- between 100 and 500 copper
2025-05-28 21:48:33 -04:00
AddCoin(Player, reward)
```