Abstract A true random number generator (TRNG) based on the stochastic delay and relaxation times of the threshold switching (TS) behavior in a Pt/HfO 2 /TiN memristor is proposed. The stochasticities of this device are attributed to its electron trapping and detrapping processes. This electronic‐switching‐based memristor exhibits several advantages, such as low power consumption and high reliability. A new circuit is designed to improve the simplicity, miniaturization, and lifetime of TRNG. The bitstreams collected from this TRNG pass the National Institute of Standards and Technology randomness tests without postprocessing, verifying the feasibility of adopting the memristor in hardware security applications. The bit generation rate in this work is sufficient for encryption applications requiring low power and low speed.