RandInt: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
==Example==
==Example==
This example outputs a random number between 5 and 10 inclusive.
This example outputs a random number between 5 and 10 inclusive.
<syntaxhighlight lang="lua">outputChatBox ( "A random value between 5 and 10 is ", randInt ( 5, 10 ) )</syntaxhighlight>
<syntaxhighlight lang="lua">
outputChatBox ( "A random value between 5 and 10 is " .. randInt ( 5, 10 ) )
</syntaxhighlight>


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

Revision as of 18:06, 26 March 2008

This function returns a random integer value between a specified minimum and maximum value.

Syntax

int randInt ( int lowerbound, int upperbound )

Required Arguments

  • lowerbound: This is the lowest random value this function can return.
  • upperbound: This is the highest random value this function can return.

Returns

Returns an int containing a random number between and potentially including lowerbound and upperbound.

Example

This example outputs a random number between 5 and 10 inclusive.

outputChatBox ( "A random value between 5 and 10 is " .. randInt ( 5, 10 ) )

See Also

Shared