built in compound operators: pick
pick:
description:
pick[n] input-seq
randomly pick n elements from each superposition in the input sequence
if n is greater than the size of the superposition, then only return size(superposition) elements
if n is less than or equal 0, return the empty ket
examples:
-- randomly pick three elements from the given superposition:
pick[3] (|one> + |two> + |three> + |four> + |five> + |six> + |seven>)
|three> + |seven> + |four>
see also:
pick-elt, weighted-pick-elt
Home