math.Rand

From GMod Wiki

Revision as of 07:08, 23 September 2009 by TheJ89 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax math.Rand( Float min, Float max )
Where is this used?
Description:
Returns a random float no smaller than min and no larger than max.
Returns: Float
Part of Library: math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.Rand]Math.Rand [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionRandomly generates a float or integer between the two given numbers.
Used onNewerShared.png
Code
local Randy = math.Rand(0,1)
Msg("Randomly chose the number " .. Randy .. "\n")
OutputOutputs a random float or integer from 0 to 1 in console.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox