### built in operators: pick-elt

pick-elt:
description:
pick-elt input-sp
randomly pick a ket from the input superposition
the probability of being picked is uniform, independent of the coefficient
the returned ket has the same coefficient as in the input superposiiton
for weighted probabilities, use weighted-pick-elt
examples:
-- if applied to an empty ket, return the empty ket:
pick-elt |>
|>
-- applied to a clean superposition:
pick-elt split |uvwxyz>
|x>
-- applied to a random superposition:
pick-elt random[1, 0.7] (|1> .. |10>)
1.108204|4>
see also:
weighted-pick-elt, random

Home