dwave.samplers.RandomSampler.sample#
- RandomSampler.sample(bqm: BinaryQuadraticModel, *, num_reads: int | None = None, time_limit: float | timedelta | None = None, max_num_samples: int = 1000, seed: None | int | Generator = None, **kwargs) 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.