Random: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncSyntax|Random([ | {{FuncDescription|Get a pseudo-random number. Negative ranges are supported as of v1.0.2.}} | ||
{{FuncSyntax|Random([Min, Max])}} | |||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParamOptional|Min| | {{FuncParamOptional|Min|The minimum number.}} | ||
{{FuncParamOptional|Max| | {{FuncParamOptional|Max|The maximum number.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|Returns the random between the range.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
Random(0, 10) -- Returns a number between 0 to 10 | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
* [[RandomFloat]] |
Latest revision as of 10:47, 6 January 2020
Description
Get a pseudo-random number. Negative ranges are supported as of v1.0.2.
Syntax
Random([Min, Max])
Parameters
- Min (optional)
The minimum number. - Max (optional)
The maximum number.
Return Value
- Returns the random between the range.
Example
Random(0, 10) -- Returns a number between 0 to 10