RandFloat: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server function}}
This function returns a random float between 0 and 1. This can act as a random on/off switch for something.
{{Deprecated|math.random}}
 
This function generates a random number between 0 and 1.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">randFloat ()</syntaxhighlight>
<syntaxhighlight lang="lua">float randFloat ()</syntaxhighlight>


===Required Arguments===
===Returns===
Returns a random number between 0 and 1 in a float.


''None.''
==Example==
This example outputs a random number in the chat box.
<syntaxhighlight lang="lua">outputChatBox ( "Random float: " .. randFloat () )</syntaxhighlight>


==Example==
==See Also==
<syntaxhighlight lang="lua">serverChat ( "Random float: ", randFloat () )</syntaxhighlight>
{{Utility functions}}

Latest revision as of 12:18, 26 June 2014