qml.devices.qubit.sample_probs¶
- sample_probs(probs, shots, num_wires, is_state_batched, rng, prng_key=None)[source]¶
Sample from given probabilities, dispatching between JAX and NumPy implementations.
- Parameters
probs (array) – The probabilities to sample from
shots (int) – The number of samples to take
num_wires (int) – The number of wires to sample
is_state_batched (bool) – whether the state is batched or not
rng (Union[None, int, array_like[int], SeedSequence, BitGenerator, Generator]) – A seed-like parameter matching that of
seed
fornumpy.random.default_rng
. If no value is provided, a default RNG will be usedprng_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.
code/api/pennylane.devices.qubit.sample_probs
Download Python script
Download Notebook
View on GitHub