Skip to content

dq.rand_ket

rand_ket(key: PRNGKeyArray, shape: tuple[int, ...]) -> Array

Returns a random ket with unit norm.

Parameters

  • key

    A PRNG key used as the random key.

  • shape (shape of the form (..., n, 1))

    Shape of the returned array.

Returns

(array of shape (*shape)) Random ket.

Examples

>>> key = jax.random.PRNGKey(42)
>>> dq.rand_ket(key, (2, 1))
Array([[-0.004+0.083j],
       [-0.26 +0.962j]], dtype=complex64)