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

validate_shots_type(shots_type: Type[int | None]) list[str]

Validate that the sampler supports the given shots type. Return a list of error messages if not supported.

Parameters:

shots_type (Type[int | None])

Return type:

list[str]

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