# Implementation of .run() methods in google Cirq

I am developing a sampling algorithm using Fourier analysis of Boolean functions for which I use Google's Cirq to obtain the state vector with .simulate().

I wanted to know what sampling algorithm Google Cirq implements with .sample() so that I can have a better idea of how to benchmark it against my algorithm. I have been looking at the docs and source code of cirq.sim.Simulator (https://quantumai.google/reference/python/cirq/sim/Simulator), but I cannot find what sampling algorithm their .run() and .sample() methods use.

cirq.Simulator() uses a statevector simulation algorithm. The resulting statevector is sampled from by first squaring the amplitudes to obtain a probability vector followed by a call to numpy.random.Generator.choice (Here's where it happens) on the probability vector to generate the results.