--Weighted Random Function

function maths:WeightedRandom(Weights,Numbers,Round)
	if #Weights == #Numbers then
		local Sum = 0
		local Rand = {}

		for i,k in pairs(Weights)do
			if type(k) ~= "number"then continue end
			Sum += k

			for j=1,k do
				table.insert(Rand,Numbers[i])
			end
		end
		if Round then
			return math.round(Rand[math.random(1,Sum)])
		else
			return Rand[math.random(1,Sum)]
		end
	end
end

return maths
