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_readsnortime_limitare provided,num_readsis set to 1. Iftime_limitis 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_readsis 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
infodictionary:num_reads: The total number of samples generated.