function SpreadSimulator.New(l)local E={}setmetatable(E,SpreadSimulator)E.runtimeData=l E.weaponDefinition=l:GetWeaponDefinition()if not E.weaponDefinition:GetSpreadRange()then return nil end E.minSpread=(E.weaponDefinition:GetSpreadRange()).x E.maxSpread=(E.weaponDefinition:GetSpreadRange()).y E.spreadIntensity=E.weaponDefinition:GetSpreadIntensity()E.spreadReduction=E.weaponDefinition:GetSpreadReduction()E.rng=Random.new()E.currentSpread=E.minSpread return E end

function SpreadSimulator.New(weaponRuntimeData)
	local self = {}
	setmetatable(self,SpreadSimulator)

	self.runtimeData = weaponRuntimeData	
	self.weaponDefinition = weaponRuntimeData:GetWeaponDefinition()
	
	if not self.weaponDefinition:GetSpreadRange() then
		return nil
	end
	
	-- Constants
	self.minSpread = self.weaponDefinition:GetSpreadRange().x
	self.maxSpread = self.weaponDefinition:GetSpreadRange().y
	self.spreadIntensity = self.weaponDefinition:GetSpreadIntensity()
	self.spreadReduction = self.weaponDefinition:GetSpreadReduction()
	self.rng = Random.new()
	
	-- Variables
	self.currentSpread = self.minSpread

	return self
end
