Lua/Shared/table/randomvalue
From JC2-MP Documentation
Returns | object |
---|---|
Prototype | table.randomvalue(table input) |
Description | Returns a random value from the input table. The table needs to be sequential. |
Examples
Basic example
local t = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} return table.randomvalue(t) -- returns a random number between 1-10
Get a random player
local playerlist = {} for player in Server:GetPlayers() do table.insert(playerlist, player) end return table.randomvalue(playerlist)