Gmod Tables Need Advice

I want this code to give random item to player and print his name
Here my code

[LUA]
local items = {“pistol”, “beer” }
ply:AddItem(table.Random(items), 1)
GAMEMODE:Notify(ply, 1, 5, table.Random(items))
[/LUA]

It give one item and print another item

You have to localize the call on table.Random() or else it will randomly call that table again.

[LUA]
local items = {“pistol”, “beer” }
local rand = table.Random(items)
ply:AddItem(rand, 1)
GAMEMODE:Notify(ply, 1, 5, rand)
[/LUA]