dimod.generators.random.randint

randint(graph, vartype, low=0, high=1, cls=<class 'dimod.binary_quadratic_model.BinaryQuadraticModel'>, seed=None)[source]

Generate a bqm with random biases and offset.

Biases and offset are integer-valued in range [low, high] inclusive.

Parameters:
  • graph (int/tuple[nodes, edges]/list[edge]/Graph) – The graph to build the bqm on. Either an integer n, interpreted as a complete graph of size n, a nodes/edges pair, a list of edges or a NetworkX graph.
  • vartype (Vartype/str/set) –

    Variable type for the binary quadratic model. Accepted input values:

    • Vartype.SPIN, 'SPIN', {-1, 1}
    • Vartype.BINARY, 'BINARY', {0, 1}
  • low (float, optional, default=0) – The low end of the range for the random biases.
  • high (float, optional, default=1) – The high end of the range for the random biases.
  • cls (BinaryQuadraticModel) – Binary quadratic model class to build from.
  • seed (int, optional, default=None) – Random seed.
Returns:

BinaryQuadraticModel