SamplerRandomBitstrings#

class iqm.qaoa.backends.SamplerRandomBitstrings[source]#

Bases: SamplerBackend

A sampler that ignores the QAOA and just produces random bitstrings of the correct length.

Methods

sample(qaoa_object, shots)

Produce random bitstrings to act as samples from the QAOA.

sample(qaoa_object, shots)[source]#

Produce random bitstrings to act as samples from the QAOA.

The qaoa_object is used only to get the number of qubits (which corresponds to the length of the bitstrings). The number of uniformly random bitstrings produced is shots and they are arranged in a dictionary just like counts from a qiskit measurement.

Parameters:
  • qaoa_object (QAOA) – The QAOA object, only used to get the number of qubits.

  • shots (int) – The number of random strings to generate.

Returns:

A dictionary whose keys are the produced random bitstrings and values their frequencies in the random set.

Return type:

dict[str, int]