1. An apparatus comprising: zero or more input terminals; at least one output terminal from which is output samples from an overall conditional probability distribution conditioned on input received on the zero or more input terminals; and a plurality of stochastic subcircuits, each including zero or more input subterminals and at least one output subterminal, wherein each of the plurality of stochastic subcircuits is configured to produce from its at least one output subterminal samples from a conditional probability distribution conditioned on input received on the zero or more input subterminals, wherein the plurality of stochastic subcircuits are interconnected to form a stochastic circuit that produces samples from the overall conditional probability distribution, and wherein each of the plurality of stochastic subcircuits generates the samples based at least in part on the conditional probability distribution and a source of randomness.