stim.Tableau.random(n) returns a random sample from $n$-qubit Clifford group using algorithm described here https://arxiv.org/pdf/2003.09412.pdf. Is there any function in stim or any relatively simple way of modifying
stim.Tableau.random() which instead of sampling the group uniformly would simply return all the elements of the $n$-qubit Clifford group (for $n<5$)? (Brute-forcing by sampling the group and keeping matrices in the list only if they have not appeared there yet sounds very inefficient for $n>2$ given the expected number of elements being at least of order $10^8$).
stim.Tableau.iter_all iterates over all tableaus.
This method doesn't exist in 1.9 (the current stable version), but you can get it in the latest dev version of 1.10:
pip install stim==1.10.dev1657673691.
You can count that there are 24 single qubit Clifford operations (up to global phase):
import stim from typing import List rotations: List[stim.Tableau] =  for tab in stim.Tableau.iter_all(1): rotations.append(tab) assert len(rotations) == 24 # Verify they're distinct. assert len(set(repr(e) for e in rotations)) == 24
The OEIS says the number of 3-qubit cliffords is 743178240. By ignoring column signs, you can count up this number in about 4 seconds:
c = 0 for _ in stim.Tableau.iter_all(3, unsigned=True): c += 1 c *= 2**6 # Account for the 6 column signs c *= 8 # Account for the 8 ignored global phases assert c == 743178240
The question says you want $n<5$, which would include $n=4$. I haven't tested fully iterating over the 47 trillion unsigned 4-qubit tableaus. Modifying the above code to count how fast the loop is running, and running it on the 4 qubit tableaus, iterates through them at about 350KHz. Which suggests it would take about a day and a half to finish the whole iteration.