Random Unicode Grapheme Cluster Generator

Sample explicit validated extended grapheme clusters using the existing repertoire sampler; segmentation follows the runtime Unicode edition, not one code point or an invented complete repertoire.

Description

Sample caller-supplied strings validated as single extended grapheme clusters under the runtime Unicode implementation.

A grapheme cluster can contain several Unicode code points while behaving as one text segment. Sampling validated clusters helps exercise interfaces with combining characters and emoji sequences.1

When to use this tool

Sample caller-supplied strings validated as single extended grapheme clusters under the runtime Unicode implementation.

  • Prepare the supplied seed, count, withoutReplacement, candidateClusters fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter seed, count, withoutReplacement, candidateClusters. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.values, result.selectedEntryIndices, result.repertoireSize. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require a nonempty distinct candidate list of valid scalar text. Use Intl.Segmenter with grapheme granularity to require exactly one cluster per entry, then sample indexes with seed/count/withoutReplacement and return the chosen strings and repertoire size.2

Input fieldMeaning and representationAccepted input
seedReproducibility seed for sampling; keep it with the inventory and output.Nonblank text, at most 256 UTF-16 code units
countNumber of draws; draws select candidate positions.Integer from 1 to 64; no more than inventory size without replacement
withoutReplacementExplicit choice for without replacement; supply a boolean rather than a text label.true or false
candidateClusterscandidate clusters.At most 128 strings, each at most 128 UTF-16 code units
Output fieldInterpretation
resultObject containing the named outputs below.
result.valuesThe values list in the ordering and representation described above.
result.selectedEntryIndicesZero-based positions of selected repertoire entries, in draw order.
result.repertoireSizeNumber of entries in the supplied validated repertoire.
json
{
  "input": {
    "seed": "tool.io/batch53",
    "count": 1,
    "withoutReplacement": true,
    "candidateClusters": [
      "\ud83d\udc69\u200d\ud83d\udcbb"
    ]
  },
  "output": {
    "result": {
      "values": [
        "\ud83d\udc69\u200d\ud83d\udcbb"
      ],
      "selectedEntryIndices": [
        0
      ],
      "repertoireSize": 1
    }
  }
}

Limitations and assumptions

  • Cluster boundaries follow the runtime's Unicode implementation and may differ across versions. The tool validates supplied entries rather than generating arbitrary Unicode, rendering glyphs or guaranteeing one screen cell per cluster.
  • Seed must be nonblank and at most 256 UTF-16 code units; count is an integer from 1 through 64. Without replacement, count cannot exceed the available inventory. Sampling is reproducible with the same seed and implementation unless an execution context supplies its own random source.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Use the linked base calculator directly when you need one known answer, and use a sampled corpus for repeatable practice. Retain the candidate inventory, seed and tool/runtime versions with a result; caller-supplied asset tokens need their own provenance and rendering workflow.

References

  1. Unicode Standard Annex 29: Text Segmentation — Unicode Consortium

  2. Tool behavior and example: Random Unicode Grapheme Cluster Generator — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies