We present an extension of Nos\'e's method of generating canonical distributions from pseudocanonical dynamics for standard Hamiltonians as well as for classical systems, where one cannot use a global set of canonical variables (e.g., a system of classical spins) and Nos\'e's formulation does not apply.