module InlineSvg
  class IdGenerator
    def self.generate(base, salt)
      bytes = Digest::SHA1.digest("#{base}-#{salt}")
      Digest.hexencode(bytes).to_i(16).to_s(36)
    end
  end
end

module InlineSvg
  class IdGenerator
    class Randomness
      require "securerandom"
      def self.call
        SecureRandom.hex(10)
      end
    end

    def self.generate(base, salt, randomness: Randomness)
      bytes = Digest::SHA1.digest("#{base}-#{salt}-#{randomness.call}")
      Digest.hexencode(bytes).to_i(16).to_s(36)
    end
  end
end

Add Randomness to ID generation
Add Randomness to ID generation
