function maths.WeightedRandom(U,Y,s,G)if#Y==#s then local U=0 local n={}for Y,G in pairs(Y)do if type(G)~="\110\117\109\098\101\114"then continue end U+=G for G=1,G,1 do table.insert(n,s[Y])end end if G then return math.round(n[math.random(1,U)])else return n[math.random(1,U)]end end end return maths

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
