cirq_google.study.FiniteRandomVariable

A sweep over randomly-sampled values from a finite distribution.

This can generate a stream of random samples pulled from a finite distribution. Some examples of possible finite distributions include a coin flip, die roll, or from {1, 0, -1}.

This sweep uses Python's internal random.choices to generate samples from the requested distribution. Given the same seed, this sequence will be identical across machines.

key symbol or string to sweep across.
distribution dictionary with keys of the potential values of the sweep. The value of the dictionary is the weight of the value in the resulting statistical distribution. This will be normalized to one. For instance, specifying weights 1,2,1 will result in a 25%, 50%, 25% distribution for the respective keys.
seed A number to seed the pseudo-random number generator.
length Number of samples which is the same as the number of sweep points.

keys The keys for the all of the sympy.Symbols that are resolved.

Methods

param_tuples

An iterator over (key, value) pairs assigning Symbol key to value.

__add__

__eq__

Return self==value.

__getitem__

__iter__

__len__

View source

__mul__

__ne__

Return self!=value.