math.random
From GMod Wiki
Function | |
Syntax |
math.random( Number Start Range[, Number End Range] ) Where is this used? |
Description: | |
Generate a random number. Both arguments are optional | |
Returns: | Integer |
Part of Library: | Math |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Math.random]Math.random [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
Additional Notes
- math.random generates a random number between two numbers, including the two numbers. For instance, if you put math.random(1, 10) then 1 and 10 are still possibilities.
- If the second argument is lower than the first argument, you'll get a Lua error.
- This function returns whole numbers, without decimals. That's the diffrence between this and math.Rand.