def METHOD_NAME(self, method, device, perm):
    """Test simulation with random unitary gate with permutations."""
    backend = self.backend(method=method, device=device)
    all_permutations = list(itertools.permutations([0, 1, 2]))
    unitary_matrix = random_unitary(8, seed=5)
    n = 3
    shots = 2000
    circuit = QuantumCircuit(n, n)
    circuit.unitary(unitary_matrix, perm)
    circuit.barrier(range(n))
    circuit.measure(range(n), range(n))
    circuits = transpile(circuit, backend)
    result = backend.run(circuits, shots=shots).result()
    state = Statevector.from_label(n * "0").evolve(unitary_matrix, perm)
    state.seed(11111)
    probs = state.probabilities_dict()
    hex_counts = {hex(int(key, 2)): val * shots for key, val in probs.items()}
    self.assertSuccess(result)
    self.compare_counts(result, [circuit], [hex_counts], delta=0.05 * shots)