Generator · Generic data

Draw a member from a weighted enumeration

Endpoint GET /v1/enum

What it covers

Returns a random member drawn from a user-supplied weighted enumeration — a JSON map of `member → relative weight` in the `choices` param. Weights need not sum to 1; they are normalized by their total, so `{"a":1,"b":4}` and `{"a":0.2,"b":0.8}` are the same distribution. `choices` must be sent as URL-encoded JSON. An empty map, or weights that are all zero, negative, or non-finite, is a 400. `edge=true` inverts the distribution (Pro), `extreme=true` returns a hostile-encoded value (Pro), and `invalid=true` returns a value not in `choices` with probability 0. This generator can also use a Dictionary defined in the Real-Fake-Data.com dashboard: pass `dictionary=<name>` instead of `choices` (requires the team’s API key).

Draws one member from a set **you** supply, with a distribution **you** control — for categorical columns no registry issues: status, tier, plan, payment method, a country skewed to your user base. The response echoes the chosen member’s normalized `probability`.

The `choices` parameter is URL-encoded JSON and accepts two shapes. Pass a **bare array** of members for an equal split, or a **weighted map** of `member → relative weight` to skew it. Weights are *relative* — they need not sum to 1, so `{"a":1,"b":4}` and `{"a":0.2,"b":0.8}` describe the same distribution, and you can think in plain counts (1-in-20) instead of fractions.

Or keep the list on our side: a **team dictionary**. Save it once in the dashboard (Dictionaries → New dictionary, kind *Enum*), then draw from it by name with `dictionary=<name>` instead of `choices` — the same list for everyone on the team, edited in one place, and no JSON in the URL. Optional weights work exactly like the weighted map. Calls with `dictionary` need an API key of that team.

Gotchas

  • Percent-encode the JSON in a real request — a browser address bar tolerates the raw brackets shown above, but a strict HTTP client needs `%7B…%7D` / `%5B…%5D`.
  • A bare array means equal weights; you do NOT need to write `{"a":1,"b":1,"c":1}`. Reach for the map only when the split is uneven.
  • An empty set, or a map whose weights are all zero / negative / non-finite, is a 400 — there is no well-defined draw.
  • With `dictionary`, `choices` is ignored. The name matches regardless of case (`Client-Products` finds `client-products`) and may contain only letters, digits, `-` and `_`.
  • `dictionary` without an API key is a 401, and a name your team has no enum dictionary for is a 404 — also when another team has one by that name. The playground works without a key, so it has no `dictionary` field; call it from your own client.
  • A saved change is live on the next call. If a call still returns the old list, the API was not told about the save (the dashboard warns when that happens) — saving the dictionary again fixes it.

Parameters

ParameterTypeDescription
choicesstringURL-encoded JSON — either a map of member → relative weight, e.g. {"gold":1,"silver":4,"bronze":15}, or a bare array of members for an equal distribution, e.g. ["gold","silver","bronze"]. Weighted values are normalized by their sum.
countinteger1–10000Number of records to return, 1–10000. Omitted returns a single record; set it for a batch. Costs 1 token plus a tenth per record.
dictionarystringpattern ^[A-Za-z0-9_-]{1,64}$Draw from a dictionary your team saved in the dashboard instead of `choices` (which is then ignored). The name is matched case-insensitively. Requires an API key of a team organization; an unknown name is a 404.
edgebooleanInvert the distribution: the least-probable member becomes the most likely (a zero-weight member rises to the top).
extremebooleanReturn the drawn member wrapped in a hostile encoding (untrimmed whitespace, invisible/zero-width characters, BOM, bidi/combining marks, or homoglyphs).
invalidbooleanReturn a value that is NOT in `choices` — a random token, with probability 0 — for exercising unexpected-value handling.
seedintegerInteger seed for reproducible output: the same seed always yields the same record.

Response fields

FieldTypeDescription
valuestringThe drawn enum member.
probabilitynumberThe member's weight normalized by the sum of all weights.

Examples

Equal split — bare array (weights optional)
GET /v1/enum?choices=["gold","silver","bronze"]
Weighted map — integer counts (drawn 1/20, 4/20, 15/20)
GET /v1/enum?choices={"gold":1,"silver":4,"bronze":15}
Weighted map — fractional probabilities
GET /v1/enum?choices={"active":0.9,"churned":0.1}
Disable a branch — a zero weight is kept but never drawn
GET /v1/enum?choices={"a":0,"b":1}
Team dictionary — the list saved in the dashboard as "client-products"
GET /v1/enum?dictionary=client-products&count=10  (Authorization: Bearer <team API key>)

Other generic generators

Try it

Generate a live example below — every response is valid by format and entirely synthetic.