  Random number generators (RNG) are essential elements in many cryptographic
systems. True random number generators (TRNG) rely upon sources of randomness
from natural processes such as those arising from quantum mechanics phenomena.
We demonstrate that a quantum computer can serve as a high-quality, weakly
random source for a generalized user-defined probability mass function (PMF).
Specifically, QC measurement implements the process of variate sampling
according to a user-specified PMF resulting in a word comprised of electronic
bits that can then be processed by an extractor function to address
inaccuracies due to non-ideal quantum gate operations and other system biases.
We introduce an automated and flexible method for implementing a TRNG as a
programmed quantum circuit that executes on commercially-available, gate-model
quantum computers. The user specifies the desired word size as the number of
qubits and a definition of the desired PMF. Based upon the user specification
of the PMF, our compilation tool automatically synthesizes the desired TRNG as
a structural OpenQASM file containing native gate operations that are optimized
to reduce the circuit's quantum depth. The resulting TRNG provides multiple
bits of randomness for each execution/measurement cycle; thus, the number of
random bits produced in each execution is limited only by the size of the QC.
We provide experimental results to illustrate the viability of this approach.
