randomgen.sfc.SFC64.weyl_increments

SFC64.weyl_increments(n, max_bits=32, min_bits=None)

Generate distinct Weyl increments to construct multiple streams

Parameters:
n

Number of distinct values to generate.

max_bits=32

Maximum number of non-zero bits in the values returned.

min_bits=None

The minimum number of non-zero bits in the values returned. The default set min_bits to max_bits. Must be <= max_bits

Returns:

An array containing distinct odd integers with between min_bits and max_bits non-zero bits.

Return type:

numpy.ndarray

Examples

>>> from randomgen import SFC64, SeedSequence
>>> seed_seq = SeedSequence(4893028492374823749823)
>>> sfc = SFC64(seed_seq)
>>> increments = sfc.weyl_increments(1000)
>>> bit_gens = [SFC64(seed_seq, k=k) for k in increments]

Notes

If n is large relative to the number of available configurations this method may be very slow. For example, if n is 1000 and max_bits=2, so that there are at most 2080 distinct values possible, then the simpler rejections sampler used will waste many draws. In practice, this is only likely to be an issue when max_bits - min_bits is small (<=3) and max_bits is close to either 0 or 64.

The values produced are chosen by first uniformly sampling the number of non-zero bits (nz_bits) in [min_bits, max_bits] and then sampling nz_bits from {0,1,2,…,63} without replacement. Finally, if the value generated has been previously generated, this value is rejected.