Module:Random/doc
Appearance
![]() | This is a documentation subpage for Module:Random. It may contain usage information, categories and other content that is not part of the original module page. |
This module contains a number of functions that use random numbers. It can output random numbers, select a random item from a list, and reorder lists randomly. The available functions are outlined in more detail below.
Number
The number
function outputs a random number.
{{#invoke:random|number|m|n}}
The arguments m
and n
may be omitted, but if specified must be convertible to integers.
- With no arguments, returns a real number in the range
- With one argument, returns an integer in the range
- With two arguments, returns an integer in the range
Examples (
){{#invoke:random|number}}
→ 0.42457232411232{{#invoke:random|number|100}}
→ 55{{#invoke:random|number|-100|-50}}
→ -70
The documentation for this function is partly taken from the Scribunto Lua reference manual, which is in turn based on the Lua 5.1 Reference Manual, available under the MIT License.