-- Creates a spread simulator based on the weapons runtime data
-- @param WeaponRuntimeData
-- @return SpreadSimulator

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
