RandomGenerator = class("RandomGenerator")

function RandomGenerator:new(seed)
	local rng = instance(self)
	rng.seed = seed
end

function RandomGenerator:get(a,b)
	local safe_seed = self.seed
	safe_seed = 40692 * (safe_seed % 52774) - 3791 * math.floor(safe_seed / 52774)
	if safe_seed <= 0 then
		safe_seed = safe_seed + 2147483399
	end
	self.seed = safe_seed

	if a then
		if b then
			if  b > a then
				return a + (safe_seed % (b - a))
			else
				return a
			end
		else
			return 1 + (safe_seed % a)
		end
	else
		return (safe_seed % 2147483399) / 2147483399
	end
end

