math.randomseed

From GMod Wiki

Jump to: navigation, search
Function
Syntax math.randomseed( Number seed )
Where is this used?
Description:
Seeds the random number generator. Use this if random values seem to be too uniform.
Returns: Number
Part of Library: Math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.randomseed]Math.randomseed [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionDemonstration of use
Used onNewerShared.png
Code
math.randomseed(os.time())
OutputSeeds the random number generator to the current time. Using a constant number defeats the whole purpose, so that it why os.time() is used.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox