toqito.rand.random_states ========================= .. py:module:: toqito.rand.random_states .. autoapi-nested-parse:: Generates random quantum states using Qiskit. Module Contents --------------- .. py:function:: random_states(n, d, seed = None) Generate a list of random quantum states. This function generates a list of quantum states, each of a specified dimension. The states are valid quantum states distributed according to the Haar measure. .. rubric:: Examples Generating three quantum states each of dimension 4. ```python exec="1" source="above" from toqito.rand import random_states states = random_states(3, 4) print(f"length of states is {len(states)}") print(f"Shape of each state vector: {states[0].shape}") for idx, state in enumerate(states): print(f"\nState {idx}:") print(state) ``` It is also possible to pass a seed to this function for reproducibility. ```python exec="1" source="above" from toqito.rand import random_states states = random_states(3, 4, seed=42) for idx, state in enumerate(states): print(f"\nState {idx}:") print(state) ``` :param n: int The number of random states to generate. :param d: int The dimension of each quantum state. :param seed: int | None A seed used to instantiate numpy's random number generator. :returns: A list of `n` numpy arrays, each representing a d-dimensional quantum state as a column vector.