generate random string

This block is part of the value group and was last modified in core v15.0.0.

generate random string v15.0.0

Generates a cryptographically random string from an alphabet you choose. Use it for human-facing codes (claim, invite, voucher) where the alphabet has to exclude lookalike characters. Every character of the alphabet is equally likely.

In pins 2
  • alphabet
    value

    The characters to pick from. Defaults to 0123456789ABCDEFGHJKLMNPQRSTUVWXYZ : digits and uppercase letters without the lookalikes I and O.

    Default 0123456789ABCDEFGHJKLMNPQRSTUVWXYZ

  • length
    number

    How many characters to generate. Maximum 4096.

    Default 8

Out pins 2
  • value
    value
  • error
    value

    NO_ALPHABET when the alphabet is empty, INVALID_LENGTH when the length is zero or negative.

Uniform (rejection-sampled) crypto-random string from the given alphabet; the default alphabet is digits plus uppercase letters WITHOUT I and O. length defaults to 8 and is SILENTLY capped at 4096. Empty alphabet -> value "" and error "NO_ALPHABET"; zero or negative length -> value "" and error "INVALID_LENGTH"; on success error is nil.

random string
random code
voucher code
claim code
custom shortid

A typical wiring for generate random string: number feeds the length pin; value feeds the alphabet pin; the value out pin feeds convert to uppercase.

Studio canvas example for the generate random string block: typical wiring for generate random string.

Commonly used with

In production blueprints, this block is most often wired together with:

  • set fields: this block feeds into it. Generates an array of mutations based on the given filled fields.
  • number: feeds into this block. Generates a valid number from the filled custom value in the blueprint.
  • value: feeds into this block. Simply returns the provided value.

Version history

Introduced in v15.0.0.


Back to value Return to the main group to view all sub-groups Back to value Return to the group to view all blocks within this group