probabilistic-analysis-and-randomized-algorithms

probabilistic-analysis-and-randomized-algorithms is a skill for Claude Code, Codex from Arcadi4/nerdy. It costs 53 tokens per session (2,192 once invoked), scanned A, original, MIT.

An algorithm guide for using probability to study random inputs or algorithms that make random choices.

In plain words
What is it for?
Use it for random permutations, indicator variables, hiring and secretary problems, balls-and-bins, collisions, birthday paradoxes, streaks, and average-case analysis.
Why use it?
It helps turn difficult counting questions into clear expected-time or expected-count analyses by defining the possible outcomes first.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/arcadi4/nerdy/probabilistic-analysis-and-randomized-algorithms
Any agent
npx skills add Arcadi4/nerdy --skill probabilistic-analysis-and-randomized-algorithms
Clone the repo
git clone --depth 1 https://github.com/Arcadi4/nerdy

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for probabilistic-analysis-and-randomized-algorithms

README.md
[![agentmods](https://agentmods.dev/badge/skills/arcadi4/nerdy/probabilistic-analysis-and-randomized-algorithms.svg)](https://agentmods.dev/skills/arcadi4/nerdy/probabilistic-analysis-and-randomized-algorithms)
Your own site
<a href="https://agentmods.dev/skills/arcadi4/nerdy/probabilistic-analysis-and-randomized-algorithms"><img src="https://agentmods.dev/badge/skills/arcadi4/nerdy/probabilistic-analysis-and-randomized-algorithms.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,192 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00053 $0.02192
Opus 5 $0.00026 $0.01096
Sonnet 5 $0.00011 $0.00438
Haiku 4.5 $0.00005 $0.00219

Measured 5d ago against content hash 56dc06bb4489, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

probabilistic-analysis-and-randomized-algorithms scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

clrs/probabilistic-analysis-and-randomized-algorithms/SKILL.md · 373 lines

How it starts

The opening of the file, as written. The whole thing — 373 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Probabilistic Analysis and Randomized Algorithms

Overview

Use probability to analyze either a distribution on inputs or random choices made by an algorithm. The core move is to name the sample space first, then convert events into expectations with indicator random variables whenever direct counting becomes messy.

Shared CLRS Conventions

Follow the parent clrs skill for mathematical formatting, formula-free headings, direct polished answers, and CLRS-wide answer style.

When to Use

  • A problem asks for average-case cost under random input order.
  • A randomized algorithm permutes, samples, searches, or makes random choices internally.
  • Expected counts involve records, collisions, empty bins, inversions, fixed points, or repeated trials.
  • A prompt asks whether a shuffle, sample, or randomized strategy is uniform.
  • A problem asks for the birthday paradox, balls-and-bins, coupon collector, streaks, or online hiring.

Do not use this skill merely because an answer contains asymptotic notation. Use characterizing-running-times when probability is not part of the model.

First Distinction

Situation Concept Expectation is over Required statement
Deterministic algorithm, random input model Average-case analysis Input distribution State the assumed input distribution
Algorithm makes random choices Expected running time or expected cost Random-number generator outcomes State the guarantee for each fixed input if applicable

Do not conflate these. Randomizing the input inside the algorithm removes the need to assume a random input distribution, but it adds work for the randomization step.

Indicator Random Variable Workflow

Use this whenever the quantity is a count of events.

  1. Define one event per item, trial, pair, or position.
  2. Define the indicator:

$$ X_i = I{A_i}. $$

  1. Use Lemma 5.1:

$$ E[X_i] = \Pr{A_i}. $$

  1. Express the total count as a sum:

$$ X = \sum_i X_i. $$

  1. Apply linearity of expectation:

Read the full file on GitHub · 373 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 373 lines · 53 tokens per session scan A 56dc06bb4489

Subscribe to this mod's changes

probabilistic-analysis-and-randomized-algorithms is a skill published in the GitHub repository Arcadi4/nerdy (7 stars, last pushed 4mo ago), licensed MIT. It adds 53 tokens to every session and 2,192 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

thermite

Thermite, the generic ISA-portable Rust SIMD library, and its thermite- companions (special, dual/autodiff, compensated/double-double, sort, sdf, geometry, ffi). Load when writing/reviewing/debugging code using thermite/thermite- crates - GenericVector/NumericVector/FloatVector bounds, the policy math library, masks…

raygon-renderer/thermite · 195 tokens

oraclaw-cmaes

CMA-ES continuous optimization for AI agents. State-of-the-art derivative-free optimizer. 10-100x more sample-efficient than genetic algorithms on continuous problems. Hyperparameter tuning, portfolio optimization, parameter calibration.

Whatsonyourmind/oraclaw · 50 tokens

oraclaw-anomaly

Anomaly detection for AI agents. Z-score, IQR, and streaming detection. Find outliers in data instantly. Sub-millisecond response. Works on single values or full datasets.

Whatsonyourmind/oraclaw · 43 tokens

oraclaw-bayesian

Bayesian inference engine for AI agents. Update beliefs with new evidence. Prior + evidence = posterior. Multi-factor prediction with calibration tracking.

Whatsonyourmind/oraclaw · 34 tokens

oraclaw-calibrate

Prediction quality scoring for AI agents. Brier score, log score, and multi-source convergence analysis. Know if your forecasts are accurate and if your data sources agree.

Whatsonyourmind/oraclaw · 39 tokens

oraclaw-forecast

Time series forecasting for AI agents. ARIMA and Holt-Winters predictions with confidence intervals. Predict revenue, traffic, prices, or any sequential data. Sub-5ms inference.

Whatsonyourmind/oraclaw · 43 tokens