Sign in

    dummy

    Download zip
    Version
    0.0.1
    License
    Apache-2.0
    Last updated
    10 hours ago
    Downloads
    5

    No dependencies

    #moonbit-community/dummy

    MoonBit fake-data generator library.

    This package keeps randomness explicit: callers pass a deterministic Rand, so tests and examples are reproducible across runs. The public facade uses MoonBit names and options such as @dummy.seed, @dummy.count_range, @dummy.int_range, @dummy.name, and @dummy.picsum_image_custom.

    The current package documents the implemented public facade, core generator abstraction, and generators for name, lorem, address, company, phone number, internet, currency, job, number, boolean, barcode, credit card, finance, color, filesystem, markdown, HTTP, chrono/time strings, administrative, automotive, identifier, encoding, and Picsum URL data.

    #Design Notes

    The library follows MoonBit conventions:

    • Generators use snake_case functions such as @dummy.name(locale=@dummy.en) with labeled options.
    • Every generator returns @core.Gen[T] instead of producing a value immediately. This keeps the random source explicit and makes tests reproducible.
    • Locale-backed tables and templates are centralized in the data package. Category packages such as name, address, and internet contain only generation logic.
    • The root package is the stable facade. Subpackages remain public for users who want category-level imports, but most application code should depend on @dummy.
    • The API returns plain MoonBit values. Identifier, encoding, semver, HTTP status, and date/time generators expose strings or integers that are easy to pass through application code and tests.

    #Seeded Generation

    Use @dummy.seed when examples or tests need stable output. The same seed and the same sequence of generator calls produce the same values.

    ///|
    test "seeded generation is reproducible" {
    let rng1 = @dummy.seed(b"readme-seed")
    let rng2 = @dummy.seed(b"readme-seed")
    let a = @dummy.name(locale=@dummy.zh_cn).dummy(rng1)
    let b = @dummy.name(locale=@dummy.zh_cn).dummy(rng2)
    @test.assert_eq(a, b)
    }

    @dummy.seed normalizes input to the 32-byte ChaCha8 seed expected by moonbitlang/core/random: shorter inputs are zero-padded and longer inputs are truncated.

    #Basic Usage

    Generators return @core.Gen[T]. Call .dummy(rng) for one value or .sample(count=..., rng) for an array of values.

    ///|
    test "basic facade usage" {
    let rng = @dummy.default_seeded()
    let name : String = @dummy.name().dummy(rng)
    let email : String = @dummy.safe_email().dummy(rng)
    let words : Array[String] = @dummy.words(count=@dummy.count_range(3, 5)).dummy(
    rng,
    )
    let ids : Array[Int32] = @dummy.int(range=@dummy.int_range(1000, 9999)).sample(
    count=4,
    rng,
    )
    assert_true(!name.is_empty())
    assert_true(email.contains("@"))
    assert_true(words.length() >= 3 && words.length() <= 5)
    @test.assert_eq(ids.length(), 4)
    }

    #Locale and Fallback

    Locale-specific data is used when data provides it. Other category requests fall back to shared defaults unless a category is explicitly locale-specific and unsupported.

    ///|
    test "locale-specific generators" {
    let rng = @dummy.default_seeded()
    let zh_name = @dummy.name(locale=@dummy.zh_tw).dummy(rng)
    let fr_company = @dummy.company_name(locale=@dummy.fr_fr).dummy(rng)
    let ja_sentence = @dummy.sentence(
    locale=@dummy.ja_jp,
    count=@dummy.count_range(4, 8),
    ).dummy(rng)
    assert_true(!zh_name.is_empty())
    assert_true(!fr_company.is_empty())
    assert_true(!ja_sentence.is_empty())
    }

    Supported locale constants:

    LocaleConstantcode
    English@dummy.enEN
    French@dummy.fr_frFR_FR
    Arabic@dummy.ar_saAR_SA
    Traditional Chinese@dummy.zh_twZH_TW
    Simplified Chinese@dummy.zh_cnZH_CN
    Japanese@dummy.ja_jpJA_JP
    Portuguese, Brazil@dummy.pt_brPT_BR
    Portuguese, Portugal@dummy.pt_ptPT_PT
    German@dummy.de_deDE_DE
    Italian@dummy.it_itIT_IT
    Welsh@dummy.cy_gbCY_GB
    Dutch@dummy.nl_nlNL_NL
    Turkish@dummy.tr_trTR_TR
    Persian, Iran@dummy.fa_irFA_IR

    #Generator Categories

    The facade exposes MoonBit snake_case functions. Locale-aware generators accept locale?; count-based text and markdown generators accept count? using @dummy.count_range(min, max).

    CategoryFacade functions
    Namefirst_name, last_name, title, suffix, name, name_with_title
    Loremword, words, sentence, sentences, paragraph, paragraphs
    Addresscity_prefix, city_suffix, city_name, country_name, country_code, street_suffix, street_name, time_zone, state_name, state_abbr, secondary_address_type, secondary_address, zip_code, post_code, building_number, latitude, longitude, geohash
    Companycompany_suffix, company_name, buzzword, buzzword_middle, buzzword_tail, catch_phrase, bs_verb, bs_adj, bs_noun, bs, profession, industry
    Internetfree_email_provider, domain_suffix, free_email, safe_email, username, password, ipv4, ipv6, ip, mac_address, user_agent
    Phonephone_number, cell_number
    Jobjob_seniority, job_field, job_position, job_title
    Number and booleandigit, number_with_format, int, boolean
    Currency, finance, and cardscurrency_code, currency_name, currency_symbol, bic, isin, credit_card_number
    Barcodeisbn, isbn10, isbn13
    Filesystem and semver stringsfile_path, file_name, file_extension, dir_path, mime_type, semver, semver_stable, semver_unstable
    Colorhex_color, rgb_color, rgba_color, hsl_color, hsla_color, color
    Chrono/time stringschrono_time, chrono_date, chrono_date_time, chrono_duration, chrono_date_time_before, chrono_date_time_after, chrono_date_time_between, time_time, time_date, time_date_time, time_duration, time_date_time_before, time_date_time_after, time_date_time_between
    HTTPhttp_status_code, rfc_status_code, valid_status_code, http_method
    Markdownitalic_word, bold_word, markdown_link, bullet_points, list_items, block_quote_single_line, block_quote_multi_line, markdown_code
    Administrativehealth_insurance_code
    Automotivelicence_plate
    Identifier stringsuuid, uuid_v1, uuid_v3, uuid_v4, uuid_v5, uuid_v6, uuid_v7, uuid_v8, ulid, bson_object_id, bson_oid
    Encoding stringsbase64, base64_padded, base64_no_pad, url_safe_base64, url_safe_base64_padded, url_safe_base64_no_pad
    Picsum image URLspicsum_image, picsum_image_with_seed, picsum_image_grayscale, picsum_image_blur, picsum_image_custom

    #API Reference

    This tracks the implemented facade using MoonBit function names, return shapes, and helper constructors exposed by this package.

    #Names

    FunctionDescription
    first_name(locale?)First/given name from the selected locale.
    last_name(locale?)Last/family name from the selected locale.
    title(locale?)Name title or honorific such as Mr. or a locale-specific form.
    suffix(locale?)Name suffix such as Jr. where the locale has data.
    name(locale?)Full name assembled with the locale template.
    name_with_title(locale?)Full name with a title, using locale-specific ordering when available.

    #Lorem

    FunctionDescription
    word(locale?)One locale-backed lorem word.
    words(locale?, count?)Array of words; the sampled length is inclusive over count.
    sentence(locale?, count?)Sentence from locale-backed words, ending with . for most locales and 。 for Chinese locales.
    sentences(locale?, count?)Array of generated sentences.
    paragraph(locale?, count?)Paragraph made from generated sentences.
    paragraphs(locale?, count?)Array of generated paragraphs.

    #Address

    FunctionDescription
    city_prefix(locale?)City prefix such as North where supported.
    city_suffix(locale?)City suffix such as town or locale-specific alternatives.
    city_name(locale?)Full city name rendered from locale templates.
    country_name(locale?)Country name table entry.
    country_code()ISO-style country code sampled from the table.
    street_suffix(locale?)Street suffix such as Street or Ave.
    street_name(locale?)Full street name rendered from locale templates.
    time_zone(locale?)Time zone identifier or locale-backed label.
    state_name(locale?)State, province, or region name.
    state_abbr(locale?)Abbreviation paired with state_name where data exists.
    secondary_address_type(locale?)Unit type such as Apt. or Suite.
    secondary_address(locale?)Unit designator plus generated number.
    zip_code(locale?)Locale-shaped ZIP code.
    post_code(locale?)Locale-shaped postal code.
    building_number(locale?)Building number rendered from locale patterns.
    latitude()Decimal latitude string in the range.
    longitude()Decimal longitude string in the range.
    geohash(precision?)Base32 geohash-like string with the requested precision.

    #Internet and Contact

    FunctionDescription
    username(locale?)Lowercase username assembled from names, words, and digits.
    free_email_provider(locale?)Free email provider domain.
    domain_suffix(locale?)Domain suffix such as com, net, or locale-specific TLDs.
    free_email(locale?)Email address using a free provider.
    safe_email(locale?)Email address under reserved documentation domains.
    password(len_range?)Password string using the password character table.
    ipv4()Dotted IPv4 string.
    ipv6()IPv6 string with hexadecimal groups.
    ip()IPv4 address string; this facade currently follows the IPv4 path.
    mac_address()Colon-separated MAC address.
    user_agent()User-agent string from the table.
    phone_number(locale?)Locale-shaped phone number.
    cell_number(locale?)Locale-shaped mobile/cell phone number.

    #Business, Money, and IDs

    FunctionDescription
    company_suffix(locale?)Company legal suffix.
    company_name(locale?)Company name rendered from locale templates.
    buzzword(locale?), buzzword_middle(locale?), buzzword_tail(locale?)Parts of a marketing buzzword phrase.
    catch_phrase(locale?)Three-part catch phrase.
    bs_verb(locale?), bs_adj(locale?), bs_noun(locale?), bs(locale?)Business-speak words and complete phrase.
    profession(locale?), industry(locale?)Profession or industry labels.
    job_seniority(locale?), job_field(locale?), job_position(locale?), job_title(locale?)Job title parts and full job title.
    currency_code(locale?), currency_name(locale?), currency_symbol(locale?)Currency metadata.
    bic()Bank Identifier Code string.
    isin()International Securities Identification Number with check digit.
    credit_card_number()Luhn-valid card number with known issuer shape.

    #Formats and Utilities

    FunctionDescription
    digit()Integer from 0 through 9.
    number_with_format(fmt)Replaces ^ with 1-9 and # with 0-9.
    int(range?)Integer sampled from a half-open [start, end) range.
    boolean(ratio?)true with the given percentage ratio, 0 through 100.
    isbn(), isbn10(), isbn13()ISBN strings with valid check digits.
    hex_color(), rgb_color(), rgba_color(), hsl_color(), hsla_color(), color()CSS-like color strings.
    file_path(), file_name(), file_extension(), dir_path(), mime_type()Path, name, extension, directory, and MIME type strings.
    semver(), semver_stable(), semver_unstable()Semantic version strings.
    uuid*(), ulid(), bson_object_id(), bson_oid()Identifier strings with expected lengths and variant/version markers.
    base64*(), url_safe_base64*()Standard or URL-safe base64 strings with optional padding.
    http_status_code(), rfc_status_code(), valid_status_code(), http_method()HTTP status codes and methods.

    #Date, Time, Markdown, and Images

    FunctionDescription
    chrono_time(locale?), chrono_date(locale?), chrono_date_time(locale?)Date/time formatted strings from the chrono generator family.
    chrono_duration()Duration as minutes.
    chrono_date_time_before(anchor_minutes?, locale?)Date-time before the anchor minute.
    chrono_date_time_after(anchor_minutes?, locale?)Date-time after the anchor minute.
    chrono_date_time_between(start_minutes, end_minutes, locale?)Date-time in the half-open minute range [start_minutes, end_minutes), requiring start_minutes < end_minutes.
    time_* variantsTime-formatted strings from the time generator family; time_date_time_between samples [start_minutes, end_minutes] and accepts equal endpoints.
    italic_word(locale?), bold_word(locale?), markdown_link(locale?)Inline Markdown strings.
    bullet_points(locale?, count?), list_items(locale?, count?)Bullet list string or numbered item array.
    block_quote_single_line(locale?, count?), block_quote_multi_line(locale?, count?), markdown_code(count?)Block quote and fenced code block strings.
    health_insurance_code(locale?)Locale-specific administrative code.
    licence_plate(locale?)Locale-specific vehicle plate.
    picsum_image*()https://picsum.photos URLs with variant-specific query/path parts.

    #Deterministic Samples

    Sampling is deterministic too. Recreate the RNG with the same seed to reproduce the same array.

    ///|
    test "sample is deterministic for a fixed seed" {
    let left = @dummy.free_email(locale=@dummy.en).sample(
    count=3,
    @dummy.seed(b"email-sample"),
    )
    let right = @dummy.free_email(locale=@dummy.en).sample(
    count=3,
    @dummy.seed(b"email-sample"),
    )
    @test.assert_eq(left, right)
    @test.assert_eq(left.length(), 3)
    for email in left {
    assert_true(email.contains("@"))
    }
    }

    Use one RNG when you want a deterministic sequence across different generators.

    ///|
    test "one rng can drive a reproducible record" {
    let rng = @dummy.seed(b"profile-record")
    let username = @dummy.username().dummy(rng)
    let password = @dummy.password(len_range=@dummy.count_range(12, 16)).dummy(
    rng,
    )
    let city = @dummy.city_name(locale=@dummy.de_de).dummy(rng)
    assert_true(!username.is_empty())
    assert_true(password.length() >= 12 && password.length() <= 16)
    assert_true(!city.is_empty())
    }

    #Composition

    Use map, flat_map, one_of, and weighted to build larger generators from the facade.

    ///|
    test "compose generators" {
    let rng = @dummy.seed(b"composition")
    let label = @dummy.company_name()
    .map(company => "customer: " + company)
    .dummy(rng)
    let contact = @dummy.one_of([@dummy.phone_number(), @dummy.cell_number()]).dummy(
    rng,
    )
    let weighted_bool = @dummy.weighted([
    (90, @dummy.boolean(ratio=100)),
    (10, @dummy.boolean(ratio=0)),
    ]).dummy(rng)
    assert_true(label.has_prefix("customer: "))
    assert_true(!contact.is_empty())
    assert_true(weighted_bool || !weighted_bool)
    }

    #Picsum Image URLs

    Picsum helpers generate https://picsum.photos/... URLs. Use @dummy.image_options with @dummy.picsum_image_custom for fixed dimensions, optional grayscale, optional blur, and an optional seed path segment.

    ///|
    test "picsum custom image url" {
    let url = @dummy.picsum_image_custom(
    @dummy.image_options(
    width=800,
    height=600,
    grayscale=true,
    blur=5,
    seed="myseed",
    ),
    ).dummy(@dummy.seed(b"picsum-custom"))
    @test.assert_eq(
    url, "https://picsum.photos/seed/myseed/800/600?grayscale&blur=5",
    )
    }

    ///|
    test "picsum predefined variants" {
    let rng = @dummy.seed(b"picsum-variants")
    let image = @dummy.picsum_image().dummy(rng)
    let gray = @dummy.picsum_image_grayscale().dummy(rng)
    let blur = @dummy.picsum_image_blur().dummy(rng)
    assert_true(image.has_prefix("https://picsum.photos/"))
    assert_true(gray.has_suffix("?grayscale"))
    assert_true(blur.contains("?blur="))
    }

    #Identifier And Encoding Strings

    Identifier and encoding generators return strings with stable, documented shapes.

    ///|
    test "identifier and encoding strings" {
    let rng = @dummy.seed(b"identifier-encoding")
    let uuid = @dummy.uuid_v4().dummy(rng)
    let ulid = @dummy.ulid().dummy(rng)
    let object_id = @dummy.bson_object_id().dummy(rng)
    let encoded = @dummy.url_safe_base64_no_pad().dummy(rng)
    @test.assert_eq(uuid.length(), 36)
    @test.assert_eq(ulid.length(), 26)
    @test.assert_eq(object_id.length(), 24)
    assert_true(!encoded.contains("="))
    }

    #Locale-Specific Reference Data

    Administrative and automotive generators use locale-backed data where the current facade exposes it.

    ///|
    test "locale-specific administrative and automotive data" {
    let rng = @dummy.seed(b"locale-specific")
    let health_code = @dummy.health_insurance_code(locale=@dummy.fr_fr).dummy(rng)
    let plate = @dummy.licence_plate(locale=@dummy.nl_nl).dummy(rng)
    assert_true(!health_code.is_empty())
    assert_true(!plate.is_empty())
    }

    #Custom DummyDefault

    For project-specific types, implement @core.DummyDefault directly.

    ///|
    struct DemoUser {
    name : String
    active : Bool
    } derive(Eq, Debug)

    ///|
    impl @core.DummyDefault for DemoUser with fn dummy_default(rng) {
    { name: @dummy.name().dummy(rng), active: @dummy.boolean().dummy(rng), }
    }

    ///|
    test "custom dummy default" {
    let user : DemoUser = @core.DummyDefault::dummy_default(
    @dummy.default_seeded(),
    )
    assert_true(!user.name.is_empty())
    }

    Dummy

    Small convenience facade that stores a locale for repeated generation.

    Use Dummy::new(locale=...) when several common generators should share the same locale without passing locale each time.

    Dummy::email

    fn Dummy::email(self : Dummy) ->
    Gen
    [String]

    Generate a locale-bound free email address.

    Dummy::name

    Generate a locale-bound full name.

    Dummy::new

    Create a locale-bound Dummy facade. Defaults to English.

    Dummy::sentence

    fn Dummy::sentence(self : Dummy) ->
    Gen
    [String]

    Generate a locale-bound lorem sentence.

    ImageOptions

    pub(all) struct ImageOptions {
    width : Int
    height : Int
    grayscale : Bool
    blur : Int?
    seed : String?
    } derive(Eq,
    Debug
    )

    Options for picsum_image_custom.

    width and height form the Picsum path. grayscale and blur become query parameters, and seed inserts a stable /seed/<value>/ path segment.

    ar_sa

    Arabic (Saudi Arabia) locale constant, equivalent to AR_SA.

    base64

    Generate a standard base64 string.

    base64_no_pad

    fn base64_no_pad() ->
    Gen
    [String]

    Generate a standard base64 string without = padding.

    base64_padded

    fn base64_padded() ->
    Gen
    [String]

    Generate a standard base64 string with padding.

    bic

    Generate a Bank Identifier Code string.

    block_quote_multi_line

    Generate a multi-line Markdown block quote.

    block_quote_single_line

    Generate Markdown block quote lines.

    bold_word

    Generate one Markdown bold word, for example **word**.

    boolean

    fn boolean(ratio? : Int) ->
    Gen
    [Bool]

    Generate true with ratio percent probability.

    ratio must be between 0 and 100 when sampled.

    Generate a complete business-speak phrase.

    bs_adj

    Generate a business-speak adjective.

    bs_noun

    Generate a business-speak noun.

    bs_verb

    Generate a business-speak verb.

    bson_object_id

    fn bson_object_id() ->
    Gen
    [String]

    Generate a 24-character lowercase hexadecimal BSON ObjectId string.

    bson_oid

    fn bson_oid() ->
    Gen
    [String]

    Alias for bson_object_id, matching the BSON OID naming.

    building_number

    Generate a building number from locale-specific number formats.

    bullet_points

    Generate a Markdown bullet list string.

    The number of bullet lines is sampled from the inclusive count range.

    buzzword

    Generate the first part of a company buzzword phrase.

    buzzword_middle

    Generate the middle part of a company buzzword phrase.

    buzzword_tail

    Generate the tail part of a company buzzword phrase.

    catch_phrase

    Generate a three-part business catch phrase.

    cell_number

    Generate a locale-shaped mobile or cell phone number.

    chrono_date

    Generate a chrono-family date string for locale.

    chrono_date_time

    Generate a chrono-family date-time string for locale.

    chrono_date_time_after

    fn chrono_date_time_after(anchor_minutes? : Int, locale? :
    Locale
    ) ->
    Gen
    [String]

    Generate a chrono-family date-time after anchor_minutes.

    chrono_date_time_before

    fn chrono_date_time_before(anchor_minutes? : Int, locale? :
    Locale
    ) ->
    Gen
    [String]

    Generate a chrono-family date-time before anchor_minutes.

    chrono_date_time_between

    fn chrono_date_time_between(start_minutes : Int, end_minutes : Int, locale? :
    Locale
    ) ->
    Gen
    [String] raise
    DummyError

    Generate a chrono-family date-time between two minute offsets.

    Raises DummyError::InvalidRange when start_minutes >= end_minutes.

    chrono_duration

    fn chrono_duration() ->
    Gen
    [Int]

    Generate a duration represented as minutes.

    chrono_time

    Generate a chrono-family time string for locale.

    city_name

    Generate a city name using locale templates.

    city_prefix

    Generate a city prefix such as North when the locale supports prefixes.

    city_suffix

    Generate a city suffix such as town or a locale-specific equivalent.

    color

    Generate a multi-line block containing hex, RGB(A), and HSL(A) color strings.

    company_name

    Generate a company name using locale templates.

    company_suffix

    Generate a company suffix such as Inc. or a locale-specific equivalent.

    count_range

    fn count_range(min : Int, max : Int) ->
    CountRange

    Create an inclusive non-negative count range for text/list generators.

    Invalid ranges are reported when the range is sampled.

    country_code

    fn country_code() ->
    Gen
    [String]

    Generate a country code from the default country-code table.

    country_name

    Generate a country name from the selected locale's country table.

    credit_card_number

    fn credit_card_number() ->
    Gen
    [String]

    Generate a Luhn-valid credit card number with a known issuer shape.

    currency_code

    Generate an ISO-style currency code for locale.

    currency_name

    Generate a currency display name for locale.

    currency_symbol

    Generate a currency symbol for locale.

    cy_gb

    Welsh (Great Britain) locale constant, equivalent to CY_GB.

    de_de

    German (Germany) locale constant, equivalent to DE_DE.

    default_seeded

    fn default_seeded() ->
    Rand

    Return the package default deterministic RNG.

    Use this for examples and quick tests. Prefer seed when a caller needs a named, reproducible random stream.

    digit

    Generate a decimal digit from 0 through 9.

    digit_string

    fn digit_string() ->
    Gen
    [String]

    Generate a decimal digit string from the NUMBER_DIGIT table.

    dir_path

    fn dir_path() ->
    Gen
    [String]

    Generate a directory path string.

    docs_locales

    Return the locale catalog used by documentation.

    domain_suffix

    Generate a domain suffix such as com, org, or a locale-specific TLD.

    English locale constant, equivalent to EN.

    fa_ir

    Persian (Iran) locale constant, equivalent to FA_IR.

    file_extension

    fn file_extension() ->
    Gen
    [String]

    Generate a file extension without a leading dot.

    file_name

    fn file_name() ->
    Gen
    [String]

    Generate a file name containing a stem and extension.

    file_path

    fn file_path() ->
    Gen
    [String]

    Generate a file path string.

    first_name

    Generate a first/given name for locale.

    fr_fr

    French (France) locale constant, equivalent to FR_FR.

    free_email

    Generate an email address at a free email provider.

    free_email_provider

    Generate a free email provider domain such as gmail.com.

    geohash

    fn geohash(precision? : Int) ->
    Gen
    [String]

    Generate a base32 geohash-like string with precision characters.

    health_insurance_code

    Generate a locale-specific administrative health insurance code.

    The data currently has meaningful coverage for French-style codes.

    hex_color

    fn hex_color() ->
    Gen
    [String]

    Generate a hex CSS color string such as #a1b2c3.

    hsl_color

    fn hsl_color() ->
    Gen
    [String]

    Generate an hsl(h, s%, l%) color string.

    hsla_color

    fn hsla_color() ->
    Gen
    [String]

    Generate an hsla(h, s%, l%, a) color string.

    http_method

    fn http_method() ->
    Gen
    [String]

    Generate an uppercase HTTP method.

    http_status_code

    fn http_status_code() ->
    Gen
    [Int]

    Generate a valid HTTP status code.

    image_options

    fn image_options(width? : Int, height? : Int, grayscale? : Bool, blur? : Int, seed? : String) -> ImageOptions

    Construct ImageOptions with current defaults.

    Defaults are 640x480, no grayscale, no blur, and no seed path segment.

    industry

    Generate an industry label.

    int

    Generate an integer from a half-open range [start, end).

    int_range

    fn int_range(start : Int, end : Int) ->
    IntRange

    Create a half-open integer range for int and lower-level core samplers.

    Invalid ranges are reported when the range is sampled.

    Generate an IP address string.

    This facade currently follows the IPv4 path.

    ipv4

    Generate a dotted IPv4 address string.

    ipv6

    Generate an IPv6 address string with hexadecimal groups.

    isbn

    Generate an ISBN string, choosing ISBN-10 or ISBN-13.

    isbn10

    Generate a valid 10-digit ISBN string.

    isbn13

    Generate a valid 13-digit ISBN string.

    isin

    Generate an International Securities Identification Number.

    it_it

    Italian (Italy) locale constant, equivalent to IT_IT.

    italic_word

    Generate one Markdown italic word, for example *word*.

    ja_jp

    Japanese locale constant, equivalent to JA_JP.

    job_field

    Generate a job field segment.

    job_position

    Generate a job position segment.

    job_seniority

    Generate a job seniority segment such as Senior or local equivalent.

    job_title

    Generate a complete job title from locale-specific job templates.

    last_name

    Generate a last/family name for locale.

    latitude

    fn latitude() ->
    Gen
    [String]

    Generate a decimal latitude string.

    licence_plate

    Generate a locale-shaped vehicle licence plate.

    list_items

    Generate numbered Markdown list item strings.

    The number of items is sampled from the inclusive count range.

    longitude

    fn longitude() ->
    Gen
    [String]

    Generate a decimal longitude string.

    mac_address

    fn mac_address() ->
    Gen
    [String]

    Generate a colon-separated MAC address string.

    markdown_code

    Generate a fenced Markdown code block.

    Generate a Markdown link whose label and path are fake data.

    mime_type

    fn mime_type() ->
    Gen
    [String]

    Generate a MIME type string such as text/plain.

    name

    Generate a full name using the selected locale's name template.

    name_with_title

    Generate a full name with title using locale-specific ordering.

    nl_nl

    Dutch (Netherlands) locale constant, equivalent to NL_NL.

    number_with_format

    fn number_with_format(fmt : String) ->
    Gen
    [String]

    Generate a string by replacing ^ with 1-9 and # with 0-9.

    Other characters are copied unchanged.

    one_of

    Choose one generator uniformly from items, then run that generator.

    Raises DummyError::EmptyCandidates if items is empty.

    paragraph

    Generate one paragraph from locale-backed lorem sentences.

    The number of sentences is sampled from the inclusive count range.

    paragraphs

    Generate an array of lorem paragraphs.

    The number of paragraphs is sampled from the inclusive count range.

    password

    Generate a password whose length is sampled from len_range.

    phone_number

    Generate a locale-shaped phone number.

    picsum_image

    fn picsum_image() ->
    Gen
    [String]

    Generate a random Picsum image URL.

    picsum_image_blur

    fn picsum_image_blur() ->
    Gen
    [String]

    Generate a Picsum image URL with a random blur query parameter.

    picsum_image_custom

    fn picsum_image_custom(opts : ImageOptions) ->
    Gen
    [String]

    Generate a Picsum image URL from explicit ImageOptions.

    picsum_image_grayscale

    fn picsum_image_grayscale() ->
    Gen
    [String]

    Generate a Picsum image URL with the grayscale query parameter.

    picsum_image_with_seed

    fn picsum_image_with_seed() ->
    Gen
    [String]

    Generate a Picsum image URL containing a random seed path segment.

    post_code

    Generate a postal-code-shaped string for the selected locale.

    profession

    Generate a profession label.

    pt_br

    Portuguese (Brazil) locale constant, equivalent to PT_BR.

    pt_pt

    Portuguese (Portugal) locale constant, equivalent to PT_PT.

    rfc_status_code

    fn rfc_status_code() ->
    Gen
    [Int]

    Generate an RFC-defined HTTP status code.

    rgb_color

    fn rgb_color() ->
    Gen
    [String]

    Generate an rgb(r, g, b) color string.

    rgba_color

    fn rgba_color() ->
    Gen
    [String]

    Generate an rgba(r, g, b, a) color string.

    safe_email

    Generate an email address under reserved documentation-safe domains.

    secondary_address

    Generate a secondary address designator with a random unit number.

    secondary_address_type

    Generate a secondary address type such as Apt. or Suite.

    seed

    fn seed(seed_bytes : Bytes) ->
    Rand

    Build a deterministic random generator from arbitrary seed bytes.

    The seed is normalized to the 32 bytes required by MoonBit's ChaCha8 generator: short inputs are zero-padded and long inputs are truncated.

    semver

    Generate a semantic version string, stable or pre-release.

    semver_stable

    fn semver_stable() ->
    Gen
    [String]

    Generate a stable semantic version string.

    semver_unstable

    fn semver_unstable() ->
    Gen
    [String]

    Generate a semantic version string with a pre-release suffix.

    sentence

    Generate one sentence ending with locale-specific punctuation.

    The number of words is sampled from the inclusive count range.

    sentences

    Generate an array of lorem sentences.

    The number of sentences is sampled from the inclusive count range.

    state_abbr

    Generate the abbreviation paired with a state or region entry.

    state_name

    Generate a state, province, or region name.

    street_name

    Generate a full street name using locale-specific templates.

    street_suffix

    Generate a street suffix such as Street, Avenue, or local equivalents.

    suffix

    Generate a name suffix such as Jr. when the locale has suffix data.

    time_date

    Generate a time-family date string for locale.

    time_date_time

    Generate a time-family date-time string for locale.

    time_date_time_after

    fn time_date_time_after(anchor_minutes? : Int, locale? :
    Locale
    ) ->
    Gen
    [String]

    Generate a time-family date-time after anchor_minutes.

    time_date_time_before

    fn time_date_time_before(anchor_minutes? : Int, locale? :
    Locale
    ) ->
    Gen
    [String]

    Generate a time-family date-time before anchor_minutes.

    time_date_time_between

    fn time_date_time_between(start_minutes : Int, end_minutes : Int, locale? :
    Locale
    ) ->
    Gen
    [String] raise
    DummyError

    Generate a time-family date-time between two minute offsets.

    Raises DummyError::InvalidRange when start_minutes > end_minutes.

    time_duration

    fn time_duration() ->
    Gen
    [Int]

    Generate a duration represented as minutes.

    time_time

    Generate a time-family time string for locale.

    time_zone

    Generate a time zone identifier or locale-backed time zone string.

    title

    Generate a name title or honorific for locale.

    tr_tr

    Turkish (Turkey) locale constant, equivalent to TR_TR.

    ulid

    Generate a 26-character Crockford-base32 ULID string.

    url_safe_base64

    fn url_safe_base64() ->
    Gen
    [String]

    Generate a URL-safe base64 string.

    url_safe_base64_no_pad

    fn url_safe_base64_no_pad() ->
    Gen
    [String]

    Generate a URL-safe base64 string without = padding.

    url_safe_base64_padded

    fn url_safe_base64_padded() ->
    Gen
    [String]

    Generate a URL-safe base64 string with padding.

    user_agent

    fn user_agent() ->
    Gen
    [String]

    Generate a user-agent string from the user-agent table.

    username

    Generate a lowercase username from name-and-word name and word patterns.

    uuid

    Generate a UUID-shaped string without forcing a specific version marker.

    Use uuid_v4 when the version marker must be 4.

    uuid_v1

    fn uuid_v1() ->
    Gen
    [String]

    Generate a UUID string with version marker 1.

    uuid_v3

    fn uuid_v3() ->
    Gen
    [String]

    Generate a UUID string with version marker 3.

    uuid_v4

    fn uuid_v4() ->
    Gen
    [String]

    Generate a UUID string with version marker 4.

    uuid_v5

    fn uuid_v5() ->
    Gen
    [String]

    Generate a UUID string with version marker 5.

    uuid_v6

    fn uuid_v6() ->
    Gen
    [String]

    Generate a UUID string with version marker 6.

    uuid_v7

    fn uuid_v7() ->
    Gen
    [String]

    Generate a UUID string with version marker 7.

    uuid_v8

    fn uuid_v8() ->
    Gen
    [String]

    Generate a UUID string with version marker 8.

    valid_status_code

    fn valid_status_code() ->
    Gen
    [Int]

    Generate a valid HTTP status code.

    weighted

    Choose one generator according to positive integer weights.

    Non-positive weights are ignored. Raises if there are no candidates or if no candidate has a positive weight.

    word

    Generate one lorem word from the selected locale's word table.

    words

    Generate an array of lorem words.

    The number of words is sampled from the inclusive count range.

    zh_cn

    Simplified Chinese locale constant, equivalent to ZH_CN.

    zh_tw

    Traditional Chinese locale constant, equivalent to ZH_TW.

    zip_code

    Generate a ZIP-code-shaped string for the selected locale.

    Source Files