Skip to content

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.

javascript
import {
	RAND_COUNT_MAX,
	RAND_LENGTH_MAX,
	RAND_LENGTH_MIN,
	RAND_SENTENCE_LENGTH_MAX
} from 'randino';
NameTypeValue
RAND_LENGTH_MINnumber1
RAND_LENGTH_MAXnumber40
RAND_SENTENCE_LENGTH_MAXnumber200
RAND_COUNT_MAXnumber10000
dart
import 'package:randino/randino.dart';
NameTypeValue
randLengthMinint1
randLengthMaxint40
randSentenceLengthMaxint200
randCountMaxint10000
python
from randino import (
    RAND_COUNT_MAX,
    RAND_LENGTH_MAX,
    RAND_LENGTH_MIN,
    RAND_SENTENCE_LENGTH_MAX,
)
NameTypeValue
RAND_LENGTH_MINint1
RAND_LENGTH_MAXint40
RAND_SENTENCE_LENGTH_MAXint200
RAND_COUNT_MAXint10000

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

javascript
import { NAME_LANGUAGES } from 'randino';
NameTypeValue
NAME_LANGUAGESNameLanguage[]Every supported name language
dart
import 'package:randino/randino.dart';
NameTypeValue
nameLanguagesList<NameLanguage>Every supported name language
python
from randino import NAME_LANGUAGES
NameTypeValue
NAME_LANGUAGEStuple[NameLanguage, …]Every supported name language

Nicknames

javascript
import { WORD_LANGUAGES, WORD_THEMES } from 'randino';
NameTypeValue
WORD_LANGUAGESWordLanguage[]Every supported nickname language
WORD_THEMESWordTheme[]All twenty-nine themes
dart
import 'package:randino/randino.dart';
NameTypeValue
wordLanguagesList<WordLanguage>Every supported nickname language
wordThemesList<WordTheme>All twenty-nine themes
python
from randino import WORD_LANGUAGES, WORD_THEMES
NameTypeValue
WORD_LANGUAGEStuple[WordLanguage, …]Every supported nickname language
WORD_THEMEStuple[WordTheme, …]All twenty-nine themes

Affixes

javascript
import {
	AFFIX_CHARSET,
	AFFIX_LENGTH_DEFAULT,
	AFFIX_LENGTH_MAX,
	AFFIX_SEPARATOR_DEFAULT
} from 'randino';
NameTypeValue
AFFIX_LENGTH_DEFAULTnumber5
AFFIX_LENGTH_MAXnumber32
AFFIX_SEPARATOR_DEFAULTstring'_'
AFFIX_CHARSETstringThe default token characters
dart
import 'package:randino/randino.dart';
NameTypeValue
affixLengthDefaultint5
affixLengthMaxint32
affixSeparatorDefaultString'_'
affixCharsetStringThe default token characters
python
from randino import (
    AFFIX_CHARSET,
    AFFIX_LENGTH_DEFAULT,
    AFFIX_LENGTH_MAX,
    AFFIX_SEPARATOR_DEFAULT,
)
NameTypeValue
AFFIX_LENGTH_DEFAULTint5
AFFIX_LENGTH_MAXint32
AFFIX_SEPARATOR_DEFAULTstr"_"
AFFIX_CHARSETstrThe 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:

javascript
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, '') });
dart
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]'), ''));
python
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:

typescript
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:

dart
import 'package:randino/randino.dart';

// Enums
NameLanguage, NameGender, NameScript
WordLanguage, WordTheme

// Values
LengthRange, NameDetail, NicknameDetail

There 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:

python
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

Released under the MIT License