qrunch.quantum.backends.random_backend

Module with implementation of a random backend for benchmarking purposes.

Classes

RandomBackend

A backend that generates random measurement results for benchmarking purposes.

RandomBackendOptions

Options for the random backend.

class RandomBackend

Bases: Backend

A backend that generates random measurement results for benchmarking purposes.

__init__(options: RandomBackendOptions = RandomBackendOptions(seed=None)) None

Initialize the random backend.

Parameters:

options (RandomBackendOptions)

Return type:

None

property name: str

Name of the backend.

run(circuits: Circuit | Sequence[Circuit], shots: int | None) SimulatedJob

Run circuit on the backend.

Parameters:
  • circuits (Circuit | Sequence[Circuit]) – The circuits to run.

  • shots (int | None) – The number of shots to use for the simulation.

Return type:

SimulatedJob

supports_shots_equals_none() bool

Return whether the backend supports shots = None.

Return type:

bool

class RandomBackendOptions

Bases: object

Options for the random backend.

All fields are immutable (frozen=True) so an instance can be safely reused.

Parameters:

seed – Seed for the random number generator. If None, a random seed will be used. (default=None)

__init__(seed: int | None = None) None
Parameters:

seed (int | None)

Return type:

None

seed: int | None = None