Skip to content

GetRandom

Return a random value from the given table, use indexes to random the value.

Argument Data Type Needed Default Description
Table table - The table to get a random index from

Dont need to be called every frame


Example
local table = {
    "Jhon",
    "Doe",
    "Smith",
    "Robinson",
    "Smith",
    "George"
}

local r = GetRandom(table)
local r2 = GetRandom(table)

print(r, r2)
Expected result
Smith,  George

Last update: October 31, 2022
Created: April 12, 2022