Example
A simple example of this function using two tables.
color
= { "green",
"red",
"blue",
"yellow" }
object
= { "car",
"house",
"bike" }
print(
"I have a " .. table.
Random( color )
.. " " .. table.
Random( object )
.. "." )
Output: I have a green house.
Example
Example of using the alternative with sequential tables for performance reasons.
websites
= {"facepunch.com",
"google.com",
"steampowered.com"}
print(
"I think the best website ever is " .. websites
[math.
random(
1,
#websites)
] .. ".")
Output: I think the best website ever is google.com.