Getting some statistics – tossing many coins in a row
Alright, so far, we have done a single coin toss at a time, much like you would do in real life.
But the power of quantum computing comes from running your quantum programs many times with the same initial conditions, letting the qubit superpositions play out their quantum mechanical advantages, and summarizing a large number of runs statistically.
With this recipe, we will do 1,000 coin tosses in the blink of an eye and take a look at the results to see how good the coin is. Will this coin be a fair way to start, say, a game of baseball? Let's see how that works.
Getting ready
The sample code for this recipe can be found here: https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience/blob/master/Chapter04/ch4_r2_coin_tosses.py.
In this recipe, we will explore and expand on the shots
job parameter. This parameter lets you control how many times you run the...