dwave.samplers.RandomSampler.sample¶
- RandomSampler.sample(bqm: dimod.binary.binary_quadratic_model.BinaryQuadraticModel, *, num_reads: Optional[int] = None, time_limit: Optional[Union[float, datetime.timedelta]] = None, max_num_samples: int = 1000, seed: Union[None, int, numpy.random._generator.Generator] = None, **kwargs) dimod.sampleset.SampleSet [source]¶
Return random samples for a binary quadratic model.
- Parameters
bqm – Binary quadratic model to be sampled from.
num_reads – The maximum number of random samples to be drawn. If neither
num_reads
nortime_limit
are provided,num_reads
is set to 1. Iftime_limit
is provided, there is no limit imposed on the number of reads.time_limit – The maximum run time in seconds. Only the time to generate the samples, calculate the energies, and maintain the population is counted.
max_num_samples – The maximum number of samples returned by the sampler. This limits the memory usage for small problems are large
time_limits
. Ignored whennum_reads
is set.seed – Seed for the random number generator. Passed to
numpy.random.default_rng()
.
- Returns
A sample set. Some additional information is provided in the
info
dictionary:num_reads: The total number of samples generated.