hybrid.utils.random_sample_seq#

random_sample_seq(size, vartype)[source]#

Return a random sample.

Parameters:
  • size (int) – Sample size (number of variables).

  • vartype (dimod.Vartype) – Variable type; for example, Vartype.SPIN, BINARY, or {-1, 1}.

Returns:

Random sample of size in length, with values from vartype.

Return type:

dict

Examples

>>> random_sample_seq(4, dimod.BINARY)      
{0: 0, 1: 1, 2: 0, 3: 0}