---
title: Sampler (v1.4)
description: API reference for qiskit.primitives.Sampler in qiskit v1.4
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit/1.4/qiskit.primitives.Sampler
---

# Sampler

*class* `qiskit.primitives.Sampler(*, options=None)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.4/qiskit/primitives/sampler.py#L39-L162)

Bases: [`BaseSampler`](/docs/api/qiskit/1.4/qiskit.primitives.BaseSampler "qiskit.primitives.base.base_sampler.BaseSampler")\[[`PrimitiveJob`](/docs/api/qiskit/1.4/qiskit.primitives.PrimitiveJob "qiskit.primitives.primitive_job.PrimitiveJob")\[[`SamplerResult`](/docs/api/qiskit/1.4/qiskit.primitives.SamplerResult "qiskit.primitives.base.sampler_result.SamplerResult")]]

Sampler V1 class.

[`Sampler`](#qiskit.primitives.Sampler "qiskit.primitives.Sampler") is a reference implementation of [`BaseSampler`](/docs/api/qiskit/1.4/qiskit.primitives.BaseSampler "qiskit.primitives.BaseSampler") (V1).

**Run Options**

- **shots** (None or int) – The number of shots. If None, it calculates the probabilities. Otherwise, it samples from multinomial distributions.
- **seed** (np.random.Generator or int) – Set a fixed seed or generator for the multinomial distribution. If shots is None, this option is ignored.

**Parameters**

**options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict) *| None*) –

> **Deprecated since version 1.2**
>
> The class `qiskit.primitives.sampler.Sampler` is deprecated as of qiskit 1.2. It will be removed no earlier than 3 months after the release date. All implementations of the BaseSamplerV1 interface have been deprecated in favor of their V2 counterparts. The V2 alternative for the Sampler class is StatevectorSampler.

**Parameters**

**options** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict) *| None*) – Default options.

**Raises**

[**QiskitError**](/docs/api/qiskit/1.4/exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") – if some classical bits are not used for measurements.

## Attributes

### options

Return options values for the estimator.

**Returns**

options

## Methods

### run

`run(circuits, parameter_values=None, **run_options)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.4/qiskit/primitives/base/base_sampler.py#L111-L142)

Run the job of the sampling of bitstrings.

**Parameters**

- **circuits** ([*QuantumCircuit*](/docs/api/qiskit/1.4/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") *| Sequence\[*[*QuantumCircuit*](/docs/api/qiskit/1.4/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit")*]*) – One of more circuit objects.
- **parameter\_values** (*Sequence\[*[*float*](https://docs.python.org/3/library/functions.html#float)*] | Sequence\[Sequence\[*[*float*](https://docs.python.org/3/library/functions.html#float)*]] | None*) – Parameters to be bound to the circuit.
- **run\_options** – Backend runtime options used for circuit execution.

**Returns**

The job object of the result of the sampler. The i-th result corresponds to `circuits[i]` evaluated with parameters bound as `parameter_values[i]`.

**Raises**

[**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError) – Invalid arguments are given.

**Return type**

T

### set\_options

`set_options(**fields)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/1.4/qiskit/primitives/base/base_primitive.py#L39-L45)

Set options values for the estimator.

**Parameters**

**\*\*fields** – The fields to update the options
