Random and Unique number Sequence

Hey guys! I’m a bit new to tables and arrays. Could someone help me convert this function that finds a set of random numbers to make sure it is unique in the numbers it chooses? I have the random seeded at the start of my code, but I need to make sure that it’s not creating duplicates.

could someone point me in a direction? Thanks.

[code]
–GET A SET OF NUMBERS AND ASSIGN IT TO ‘shapesChosen’ TABLE
local shapesChosen ={}
local function shapeChooser()
local function getShapeNumbers()

for i=1,numThisRound do
shapesChosen[i]=math.random(#allShapes) – random number between 1 and total # shapes
print("i = "…shapesChosen[i])

end
end
getShapeNumbers()
for i,v in ipairs(shapesChosen) do print(i,v) end

end
[/code] [import]uid: 10361 topic_id: 8156 reply_id: 308156[/import]