sample_state(state, shots, is_state_batched=False, wires=None, rng=None, prng_key=None)[source]

Returns a series of computational basis samples of a state.

  • state (array[complex]) – A state vector to be sampled

  • shots (int) – The number of samples to take

  • is_state_batched (bool) – whether the state is batched or not

  • wires (Sequence[int]) – The wires to sample

  • rng (Union[None, int, array_like[int], SeedSequence, BitGenerator, Generator]) – A seed-like parameter matching that of seed for numpy.random.default_rng. If no value is provided, a default RNG will be used

  • prng_key (Optional[jax.random.PRNGKey]) – An optional jax.random.PRNGKey. This is the key to the JAX pseudo random number generator. Only for simulation using JAX.


Sample values of the shape (shots, num_wires)

Return type