GenerateRandomSearch

Markov Chain Simulator

A Markov chain is a system where the next state depends only on the current one — weather, machine condition, customer status, board position. The interesting question is what happens in the long run, and the honest answer is that many chains have no long-run distribution at all. A chain with an absorbing state ends up wherever it got stuck; a periodic chain oscillates forever. This one detects both and says so rather than quoting a number it cannot justify.

What this generator does

Takes a transition matrix, normalises each row so it is a genuine probability distribution, then does two separate things: it computes the long-run distribution by power iteration, and it simulates an actual run. The two are shown side by side and clearly labelled, because a finite run never lands exactly on the theoretical limit.

How to use this tool

  1. Type one state per line with its transition probabilities.
  2. Rows that do not sum to 1 are rescaled, and the tool says so.
  3. Run the simulation and compare what happened to the long-run distribution.
  4. Seed it to reproduce a particular run.

Understanding the controls

States and probabilities
One line per state, as a name then its probabilities to every state in order. Entering 2, 1, 1 is the same as 0.5, 0.25, 0.25 — rows are rescaled and the tool tells you when it did.
How many steps
A longer run gets closer to the long-run behaviour. Watching a short run miss it is instructive.
Start from
Which state the simulation begins in. For a chain with a genuine steady state this does not change the long run; for an absorbing chain it changes everything.
Seed
Any word reproduces the same result exactly. Leave it empty and the browser's cryptographic generator is used instead.

Common use cases

  • Modelling weather, machine states or customer lifecycles
  • Seeing whether a process settles down or cycles forever
  • Teaching why an absorbing chain has no unique steady state
  • Checking a transition matrix behaves as intended before using it
  • Comparing a finite simulation against the theoretical limit

How this generator works

Rows are normalised on entry. The long-run distribution comes from power iteration, but only after three structural checks: an absorbing state means the limit depends on the starting point, a reducible chain has different behaviour per component, and a periodic chain never converges at all. Any of those and the tool reports why instead of a distribution. Simulation uses inverse-transform sampling on each row.

Randomness and fairness

Which path the simulation takes is random; the transition probabilities and the long-run distribution are not. A seeded run is reproducible and therefore explicitly not cryptographically secure; without a seed the browser's cryptographically secure generator is used.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • It handles discrete time and a finite number of states. Continuous-time chains behave differently.
  • Ten states is the maximum, which keeps the matrix readable and the arithmetic exact.
  • The simulated proportions are one sample. Re-running with another seed gives different numbers, which is the point.
  • Your matrix is not stored anywhere, so keep a copy of anything you want to return to.

Privacy and your data

Your state names and transition probabilities stay in the browser. Nothing you type is transmitted, logged or stored between visits.