Random: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
28days (talk | contribs)
No edit summary
Line 1: Line 1:
{{Info|Function|Server & Client|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|Get a pseudo-random number.}}
{{FuncDescription|Get a pseudo-random number. Negative ranges are supported as of v1.0.2.}}


{{FuncSyntax|Random([Min, Max])}}
{{FuncSyntax|Random([Min, Max])}}
Line 12: Line 12:


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
Random(0, 10) -- Returns a number between 0 to 10
<syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
* [[RandomFloat]]
* [[RandomFloat]]

Revision as of 10:46, 6 January 2020

Random

Type: Function
Context: Server & Client
Introduced: v1.0

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

<syntaxhighlight lang="Lua"> Random(0, 10) -- Returns a number between 0 to 10 <syntaxhighlight>

See also