The number of

-bit Gray codes is the number in a well-defined subset of the permutations of the integers

to

. Generating random permutations with associated estimates under suitably restrictive selection rules produces a discrete distribution whose expectation value is the number of such codes. The number of Hamiltonian circuits on the

-cube (cyclic Gray codes) is a further subset which can readily be estimated also. Reliable statistical estimates up to

were produced with reasonable speed by computer implementation of this Monte Carlo process; excellent agreement with the exact values for

and

was obtained. Proofs are given of the validity of the technique and of an upper bound for the total number of Gray codes. The technique could also be used to count permutation subsets other than Gray codes.