-- @Description Retrieve a random element from a table, %Random is an optional Random Object.
-- @Arg1 Table
-- @Arg2 Random

function Basic.GetTableRandom(Tbl, rng)
	if type(Tbl) ~= "table" then return Tbl end
	
	local Rng = rng or System.Random
	if Tbl.Min and Tbl.Max then
		return Rng:NextNumber(Tbl.Min, Tbl.Max)
	end
	
	local Array = Basic.TableToArray(Tbl)
	return Array[Rng:NextInteger(1, #Array)]
end
