RandFloat: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(5 intermediate revisions by 5 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===


''None.''
===Returns===
Returns a random number between 0 and 1 in a float.


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


==See Also==
==See Also==
{{Utility functions}}
{{Utility functions}}

Latest revision as of 12:18, 26 June 2014