Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
DSFMT,
MT64,
MT19937,
PCG64,
PCG64DXSM128,
PCG64DXSM,
LXM,
SFMT,
AESCounter,
ChaCha,
Philox,
ThreeFry,
Xoshiro256,
Xoshiro512,
JSF,
Romu,
RomuTrio,
HC128,
SPECK128,
SFC64,
EFIIX64,
]
if HAS_RDRND:
PRNGS.append(RDRAND)
funcs = OrderedDict()
funcs["Uint32"] = f'integers(2**32, dtype="uint32", size={SIZE})'
funcs["Uint64"] = f'integers(2**64, dtype="uint64", size={SIZE})'
funcs["Uniform"] = f"random(size={SIZE})"
funcs["Expon"] = f"standard_exponential(size={SIZE})"
DSFMT,
EFIIX64,
HC128,
JSF,
LXM,
PCG64,
LCG128Mix,
MT19937,
Philox,
SFC64,
SFMT,
SPECK128,
ThreeFry,
Xoshiro256,
Xoshiro512,
Romu,
]
JUMPABLE = [bg for bg in ALL_BIT_GENS if hasattr(bg, "jumped")]
SPECIALS = {
ChaCha: {"rounds": [8, 20]},
JSF: {"seed_size": [1, 3]},
SFC64: {"k": [1, 3394385948627484371, "weyl"]},
LCG128Mix: {"output": ["upper"]},
PCG64: {"variant": ["dxsm", "dxsm-128", "xsl-rr"]},
Romu: {"variant": ["quad", "trio"]},
}
OUTPUT = defaultdict(lambda: 64)
OUTPUT.update({MT19937: 32, DSFMT: 32})
with open("templates/configuration.jinja") as tmpl:
TEMPLATE = jinja2.Template(tmpl.read())
def __init__(self, *args, **kwargs):
if "width" in kwargs:
del kwargs["width"]
super().__init__(*args, width=32, **kwargs)
class Philox2x64(Philox):
canonical_repr = "Philox(n=2, w=64)"
def __init__(self, *args, **kwargs):
if "number" in kwargs:
del kwargs["number"]
super().__init__(*args, number=2, **kwargs)
class RomuTrio(Romu):
canonical_repr = 'Romu(variant="trio")'
def __init__(self, *args, **kwargs):
if "variant" in kwargs:
del kwargs["variant"]
super().__init__(*args, variant="trio")
class ThreeFry4x32(ThreeFry):
canonical_repr = "ThreeFry(n=4, w=32)"
def __init__(self, *args, **kwargs):
if "width" in kwargs:
del kwargs["width"]
super().__init__(*args, width=32, **kwargs)