{
  "slug": "monte-carlo-sim",
  "name": "gizza-ai/monte-carlo-sim",
  "version": "0.1.0",
  "title": "Monte Carlo Simulation — model risk & uncertainty online — gizza.ai",
  "description": "Run Monte Carlo simulations in your browser: define input distributions, a formula, and trials, then get percentiles, target probability, and a histogram.",
  "tags": [
    "monte carlo simulation",
    "risk analysis",
    "probability calculator",
    "uncertainty modeling",
    "percentile confidence",
    "project risk",
    "distribution sampling"
  ],
  "category": "data",
  "urls": {
    "page": "https://gizza.ai/tools/monte-carlo-sim/",
    "markdown": "https://gizza.ai/tools/monte-carlo-sim/index.md",
    "descriptor": "https://gizza.ai/tools/monte-carlo-sim/tool.json",
    "deep_link_example": "https://gizza.ai/tools/monte-carlo-sim/?variables=revenue%20%3D%20normal%281000%2C%20200%29%0Acost%20%3D%20uniform%28400%2C%20700%29&model=revenue%20-%20cost&trials=10000&seed=42&threshold_direction=at-or-above&histogram_bins=20"
  },
  "cli": "gizza tool monte-carlo-sim \"revenue = normal(1000, 200)\ncost = uniform(400, 700)\" 'model=revenue - cost'",
  "tool": {
    "description": "Run a Monte Carlo simulation of a user-defined model. Declare uncertain input variables as probability distributions (one 'name = distribution(args)' per line — normal, uniform, triangular, lognormal, constant), combine them in a model formula (e.g. 'revenue - cost'), and sample `trials` outcomes (default 10000). Returns the outcome distribution (mean, std dev, min, max), percentiles P5–P99 (read as confidence levels, e.g. P90), an optional probability of meeting a `threshold` target (at-or-above / at-or-below), and a text histogram (`histogram_bins` rows, 0 to hide). Deterministic given a `seed`. Runs locally.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "histogram_bins": {
          "default": 20,
          "description": "Number of rows in the text histogram of the outcome distribution (default 20; 0 hides the histogram; max 40).",
          "maximum": 40,
          "minimum": 0,
          "type": "integer"
        },
        "model": {
          "description": "The output formula combining the variables, evaluated once per trial. Supports + - * / ^, parentheses, functions (sin, cos, sqrt, abs, ln, exp, min, max, …) and constants (pi, e). Every name must be a declared variable. E.g. 'revenue - cost'.",
          "type": "string"
        },
        "seed": {
          "default": 42,
          "description": "Random seed for the deterministic PRNG (default 42). The same seed + inputs always produce identical results; change it to draw a different sample.",
          "minimum": 0,
          "type": "integer"
        },
        "threshold": {
          "description": "Optional target value. When set, the report adds the probability that the outcome meets this target (P80/P95-style confidence). Omit to skip.",
          "type": "number"
        },
        "threshold_direction": {
          "default": "at-or-above",
          "description": "Which side of the threshold counts as a success: 'at-or-above' = P(outcome >= threshold), 'at-or-below' = P(outcome <= threshold). Only used when threshold is set.",
          "enum": [
            "at-or-above",
            "at-or-below"
          ],
          "type": "string"
        },
        "trials": {
          "default": 10000,
          "description": "Number of random trials to sample (default 10000; 100–1000000). More trials tighten the percentile estimates.",
          "maximum": 1000000,
          "minimum": 100,
          "type": "integer"
        },
        "variables": {
          "description": "Uncertain input variables, one 'name = distribution(args)' per line. Supported distributions: normal(mean, std_dev), uniform(min, max), triangular(min, mode, max), lognormal(mu, sigma), constant(value). Blank lines and '#' comments are ignored. E.g. 'revenue = normal(1000, 200)\\ncost = uniform(400, 700)'.",
          "type": "string"
        }
      },
      "required": [
        "variables",
        "model"
      ],
      "type": "object"
    }
  }
}