  This paper considers right-invariant and controllable driftless quantum
systems with state X(t) evolving on the unitary group U(n) and m inputs. The
T-sampling stabilization problem is introduced and solved: given any initial
condition X(0) any goal state Xg find a feedback law such that X(jT) converges
to Xg as the integer j tends to infinity. The purpose is to generate arbitrary
quantum gates corresponding to Xg. This is achieved by the tracking of
T-periodic reference trajectories that pass by Xg using the framework of
Coron's Return Method. The T-periodic reference trajectories are generated by
applying open-loop controls that are a sum of a finite number M of odd
T-periodic function whose amplitudes are parameterized by a vector. The main
result establishes that, for M big enough, X(jT) exponentially converges
towards Xg for almost all fixed amplitude vectors, with explicit and completely
constructive control laws. This paper also establishes a stochastic version of
this deterministic control law. The key idea is to randomly choose a different
amplitude vector at each sampling time jT, and keeping it fixed until the next
sampling time (j+1)T. It is also shown that X(jT) exponentially converges
towards Xg almost surely. Simulation results have indicated that the
convergence speed may be significantly improved with such stochastic technique.
This is illustrated in the generation of the C--NOT quantum logic gate on U(4).
