Random Vitamin Picker

Select vitamin record IDs from a caller-supplied normalized dataset while preserving dataset and source provenance.

Description

Select vitamin record IDs from your candidate list while returning its dataset and source labels.

Vitamins can be represented as records with stable identifiers, names, and other dataset fields. For quizzes or data fixtures, selecting an identifier lets the application retrieve a consistent record while keeping the random-selection step separate from nutritional interpretation.

Recording data provenance helps identify the context of an output. Here datasetId, datasetVersion, and sourceId are caller-supplied labels copied into the result, not verified lineage or a complete provenance record.1

Provide the vitamin catalog and unique candidate IDs yourself. The returned selectedIds are references, not complete records; the tool performs no external lookup. Sampling defaults to without replacement within one run.

When to use Random Vitamin Picker

Use it for vitamin cards or nutrition-data fixtures when an explicit source dataset and eligible candidate list are available.

How to use Random Vitamin Picker and understand its results

  1. Enter 1–1,000 unique nonblank candidateIds and nonblank datasetId, datasetVersion, and sourceId. Resolve the IDs against your own catalog.
  2. Enter selectionCount from 1 through 1,000. Leave withReplacement false to select distinct IDs, with count no greater than the candidate list; set it true to allow repeated draws.
  3. Run the picker and read selectedIds with the returned dataset and source labels. Retrieve record details from that same dataset version separately.
with replacement: index = floor(randomDraw × candidate count)

Each draw samples the complete candidate list, so the same ID can recur within a result.

Without replacement, the implementation copies the candidate list and performs a partial Fisher–Yates shuffle: on draw d, choose a position from d through the final index, swap it into position d, and emit that ID. With independent uniform draws, remaining candidates are equally likely; the input list is not mutated.

ID equality is exact string equality. Blankness is checked after trimming, but accepted IDs and metadata are returned as supplied rather than trimmed or normalized.

json
{
  "input": {
    "candidateIds": [
      "candidate-a",
      "candidate-b",
      "candidate-c"
    ],
    "datasetId": "example/vitamin",
    "datasetVersion": "1",
    "selectionCount": 2,
    "sourceId": "example",
    "withReplacement": false
  },
  "randomDraw": 0.25,
  "output": {
    "datasetId": "example/vitamin",
    "datasetVersion": "1",
    "selectedIds": [
      "candidate-a",
      "candidate-b"
    ],
    "sourceId": "example"
  }
}

One candidate can be drawn repeatedly when replacement is enabled. Without replacement, requesting more selections than candidates is rejected. Duplicate IDs, empty lists, blank labels, and invalid random draws also fail. Duplicates may recur across separate runs.

Limitations and assumptions

The default source is Math.random; no seed input or cryptographic entropy guarantee is provided. Repeated runs may select the same result, and the distribution depends on the random source.

It does not recommend supplements, determine deficiencies, infer doses, or provide a built-in vitamin reference table.

The generator does not validate record existence, source authority, dataset version availability, category membership, or coverage. Equal selection probability over supplied IDs is not a representative sample of a market or population.

Alternative or Complementary methods

Prepare filters and normalized records before selection, then retrieve details after it. General catalog selectors use the same selection concept for a broader domain; a bounded integer generator can support a simple index exercise without preserving catalog labels.

References

  1. PROV-Overview: An Overview of the PROV Family of Documents — World Wide Web Consortium

Similar or alternative tools

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