DrawMany operation

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Arrays

Package: Microsoft.Quantum.Standard

Repeats an operation for a given number of samples, collecting its outputs in an array.

operation DrawMany<'TInput, 'TOutput> (op : ('TInput => 'TOutput), nSamples : Int, input : 'TInput) : 'TOutput[]

Input

op : 'TInput => 'TOutput

The operation to be called repeatedly.

nSamples : Int

The number of samples of calling op to collect.

input : 'TInput

The input to be passed to op.

Output : 'TOutput[]

Type Parameters

'TInput

'TOutput

Example

The following samples an integer, given an operation that samples a single bit at a time.

let randomInteger = BoolArrayAsInt(DrawMany(SampleRandomBit, 16, ()));

See Also