Skip to content

random_helper

django_spire.contrib.seeding.field.seed.helper.random_helper

RandomFieldSeedHelper

Bases: FieldSeedHelper

Source code in django_spire/contrib/seeding/field/seed/helper/helper.py
def __init__(self, locale: str | list[str] = 'en_CA') -> None:
    self.locale = locale

choice staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/random_helper.py
@staticmethod
def choice(sequence: Sequence) -> CallableFieldSeed:
    return CallableFieldSeed(random.choice, seq=sequence)

enum staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/random_helper.py
@staticmethod
def enum(enum_: Enum) -> RandomEnumFieldSeed:
    return RandomEnumFieldSeed(enum_=enum_)

float staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/random_helper.py
@staticmethod
def float(a: float = 0.0, b: float = 1.0) -> CallableFieldSeed:
    return CallableFieldSeed(random.uniform, a=a, b=b)

int staticmethod

Source code in django_spire/contrib/seeding/field/seed/helper/random_helper.py
@staticmethod
def int(a: int = 0, b: int = 100) -> CallableFieldSeed:
    return CallableFieldSeed(random.randint, a=a, b=b)