Can someone please tell me how this chance system works?

```
local chances = {}
for i,v in pairs(oresSS:GetChildren()) do
if (v.Depth.Value-1) <= backD and (v.MaxDepth.Value-1) >= backD then
for i = 1,v.Chance.Value do
table.insert(chances,v.Name)
end
end
end
if #chances >= 1 then
local random = math.random(1,#chances)
local cBlock = oresSS:FindFirstChild(chances[random]):Clone()
cBlock.Parent = ores
cBlock.Anchored = true
cBlock.CFrame = back
table.insert(Airs,back)
if cBlock:FindFirstChild("CreateNew") then
createBlock(cBlock)
end
end
end
if bottomA == false then
local chances = {}
for i,v in pairs(oresSS:GetChildren()) do
if (v.Depth.Value-1) <= bottomD and (v.MaxDepth.Value-1) >= bottomD then
for i = 1,v.Chance.Value do
table.insert(chances,v.Name)
end
end
end
if #chances >= 1 then
local random = math.random(1,#chances)
local cBlock = oresSS:FindFirstChild(chances[random]):Clone()
cBlock.Parent = ores
cBlock.Anchored = true
cBlock.CFrame = bottom
table.insert(Airs,bottom)
if cBlock:FindFirstChild("CreateNew") then
createBlock(cBlock)
end
end
```

Im working on a mining game and im using a piece of sample code. I’m trying to figure out how the spawn chance system works but i cant tell from this code.