Constants
The lists the generators accept, and the hard bounds every numeric option is clamped to. Nothing here throws: a count of -10 returns nothing and a count of a million returns ten thousand.
Shared bounds
Every generator counts, clamps and deduplicates the same way, so the bounds are one set rather than one per generator.
import {
RAND_COUNT_MAX,
RAND_LENGTH_MAX,
RAND_LENGTH_MIN,
RAND_SENTENCE_LENGTH_MAX
} from 'randino';| Name | Type | Value |
|---|---|---|
RAND_LENGTH_MIN | number | 1 |
RAND_LENGTH_MAX | number | 40 |
RAND_SENTENCE_LENGTH_MAX | number | 200 |
RAND_COUNT_MAX | number | 10000 |
import 'package:randino/randino.dart';| Name | Type | Value |
|---|---|---|
randLengthMin | int | 1 |
randLengthMax | int | 40 |
randSentenceLengthMax | int | 200 |
randCountMax | int | 10000 |
from randino import (
RAND_COUNT_MAX,
RAND_LENGTH_MAX,
RAND_LENGTH_MIN,
RAND_SENTENCE_LENGTH_MAX,
)| Name | Type | Value |
|---|---|---|
RAND_LENGTH_MIN | int | 1 |
RAND_LENGTH_MAX | int | 40 |
RAND_SENTENCE_LENGTH_MAX | int | 200 |
RAND_COUNT_MAX | int | 10000 |
The length options are clamped into 1 … 40, counted in characters of what the generator returns, except on randSentence, whose ceiling is 200. A sentence is many words where a name, a word and a nickname are at most three. count is clamped into 0 … 10000, because an unbounded count with unique on can spend a long time re-drawing from an exhausted pool.
Names
import { NAME_LANGUAGES } from 'randino';| Name | Type | Value |
|---|---|---|
NAME_LANGUAGES | NameLanguage[] | Every supported name language |
import 'package:randino/randino.dart';| Name | Type | Value |
|---|---|---|
nameLanguages | List<NameLanguage> | Every supported name language |
from randino import NAME_LANGUAGES| Name | Type | Value |
|---|---|---|
NAME_LANGUAGES | tuple[NameLanguage, …] | Every supported name language |
Nicknames
import { WORD_LANGUAGES, WORD_THEMES } from 'randino';| Name | Type | Value |
|---|---|---|
WORD_LANGUAGES | WordLanguage[] | Every supported nickname language |
WORD_THEMES | WordTheme[] | All twenty-nine themes |
import 'package:randino/randino.dart';| Name | Type | Value |
|---|---|---|
wordLanguages | List<WordLanguage> | Every supported nickname language |
wordThemes | List<WordTheme> | All twenty-nine themes |
from randino import WORD_LANGUAGES, WORD_THEMES| Name | Type | Value |
|---|---|---|
WORD_LANGUAGES | tuple[WordLanguage, …] | Every supported nickname language |
WORD_THEMES | tuple[WordTheme, …] | All twenty-nine themes |
Affixes
import {
AFFIX_CHARSET,
AFFIX_LENGTH_DEFAULT,
AFFIX_LENGTH_MAX,
AFFIX_SEPARATOR_DEFAULT
} from 'randino';| Name | Type | Value |
|---|---|---|
AFFIX_LENGTH_DEFAULT | number | 5 |
AFFIX_LENGTH_MAX | number | 32 |
AFFIX_SEPARATOR_DEFAULT | string | '_' |
AFFIX_CHARSET | string | The default token characters |
import 'package:randino/randino.dart';| Name | Type | Value |
|---|---|---|
affixLengthDefault | int | 5 |
affixLengthMax | int | 32 |
affixSeparatorDefault | String | '_' |
affixCharset | String | The default token characters |
from randino import (
AFFIX_CHARSET,
AFFIX_LENGTH_DEFAULT,
AFFIX_LENGTH_MAX,
AFFIX_SEPARATOR_DEFAULT,
)| Name | Type | Value |
|---|---|---|
AFFIX_LENGTH_DEFAULT | int | 5 |
AFFIX_LENGTH_MAX | int | 32 |
AFFIX_SEPARATOR_DEFAULT | str | "_" |
AFFIX_CHARSET | str | The default token characters |
The charset is alphanumerics minus the pairs that misread: no 0 or O, no 1, l or I. An affix is something somebody reads off a screen and types into another one, and those five characters are where that goes wrong.
Narrow it or extend it through charsetcharsetcharset. Starting from the default rather than from the alphabet keeps that property:
import { AFFIX_CHARSET, randSuffix } from 'randino';
// Digits only.
randSuffix('MistyOwl', { charset: '0123456789' });
// The default, minus the upper case.
randSuffix('MistyOwl', { charset: AFFIX_CHARSET.replace(/[A-Z]/g, '') });import 'package:randino/randino.dart';
// Digits only.
randSuffix('MistyOwl', charset: '0123456789');
// The default, minus the upper case.
randSuffix('MistyOwl', charset: affixCharset.replaceAll(RegExp('[A-Z]'), ''));from randino import AFFIX_CHARSET, rand_suffix
# Digits only.
rand_suffix("MistyOwl", charset="0123456789")
# The default, minus the upper case.
rand_suffix("MistyOwl", charset="".join(c for c in AFFIX_CHARSET if not c.isupper()))Types
Every public type is exported alongside the functions, so an options object can be typed on its own:
import type {
NameDetail,
NameGender,
NameGenderOption,
NameLanguage,
NameLanguageOption,
NameScript,
NicknameDetail,
WordLanguage,
WordLanguageOption,
WordTheme,
WordThemeOption,
RandNameOptions,
RandNicknameOptions,
RandOutput
} from 'randino';
const options: RandNameOptions = { language: 'ko', count: 3 };The …Option types are the union of a language or theme with 'all', so NameLanguageOption is NameLanguage | 'all'. Use the narrower one wherever 'all' is not a valid answer, which is what the helpers do.
Every public type is exported alongside the functions:
import 'package:randino/randino.dart';
// Enums
NameLanguage, NameGender, NameScript
WordLanguage, WordTheme
// Values
LengthRange, NameDetail, NicknameDetailThere is no …Option type and no all member: a null enum is what means "every one of them", so the parameter you do not write is already the mixed draw. That also means the helpers take the same type the generators do, rather than a narrower one.
Every public type is importable alongside the functions, and the package ships a py.typed marker so a checker reads them:
from randino import (
NameDetail,
NameGender,
NameGenderOption,
NameLanguage,
NameLanguageOption,
NameScript,
NicknameDetail,
WordLanguage,
WordLanguageOption,
WordTheme,
WordThemeOption,
RandOutput,
)
language: NameLanguageOption = "ko"They are Literal types rather than classes, so "kr" is rejected where NameLanguage is expected. The …Option types add "all", so NameLanguageOption is NameLanguage | Literal["all"]. Use the narrower one wherever "all" is not a valid answer.
There is no options type to import: the arguments are keyword-only rather than an object, so there is nothing to annotate.
See also
- Supported languages — what each language code covers.
- Themes — what each theme holds.