Member-only story
Your First Hands-on Guide To Quantum Programming With Qiskit
From mathematics to code, here’s everything that you need to know to write and run your first Quantum program on an IBM Quantum computer.

Quantum computing is getting big, and here’s your chance to learn about it and give yourself a head start.
This article is a practical guide to learning Quantum programming by building a truly random number generator/ Quantum Random Number Generator (QRNG) from scratch.
To make this tutorial accessible to most, all the code is written in Python using Qiskit (the most popular Quantum programming SDK), in a Google Colaboratory notebook.
Excited? Let’s begin!
First, It’s Time For Some Theory On Randomness
True randomness is challenging to create.
Most random numbers you see being used in computers are created using deterministic algorithms called Pseudorandom number generators (PRNGs).
For example, Python’s random
library uses the Mersenne Twister algorithm to generate pseudo-random numbers.
This means that they are not truly random. If one knew the exact seed and conditions used to create them, they could create a similar number using the algorithm.
(Quick question. Do you consider a roll of a dice truly random? Be ready to get this belief shattered.)
Can quantum computers help us create a truly random number, then?
The answer is surprisingly — Yes!
We know from a previous lesson that on the computational basis, a qubit can exist in a superposition of two basis states (|0⟩
and |1⟩
).
where α
and β
are complex numbers called Probability amplitudes.
When a qubit is measured, the probabilities of measuring the qubit in the states |0⟩
and |1⟩
are given by ∣α|²
and ∣β∣²
, respectively.
We can create a truly random number generator called Quantum Random Number Generator (QRNG) using this principle.