Skip to content

dq.random.ket

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.random.ket(key, (2, 1))
Array([[-0.004+0.083j],
       [-0.26 +0.962j]], dtype=complex64)