GenerateRandomSearch

Stochastic Matrix Generator

A stochastic matrix is a table of transition probabilities, and its defining property is that every row sums to exactly one. Building one with decimals will not give you that — floating point does not add up neatly — so these are constructed as integers over a common denominator, where the sum is a matter of arithmetic rather than of tolerance. Occasionally the columns sum to one as well, which makes the matrix doubly stochastic and the uniform distribution stationary.

What this generator does

Splits the denominator into as many non-negative parts as there are states, once per row, by choosing cut points. Each row therefore sums to the denominator exactly, and the decimal view is derived from those integers rather than the other way round.

How to use this tool

  1. Choose the number of states and the denominator.
  2. Check that each row sums to one.
  3. Look for whether the columns happen to as well.
  4. Copy the matrix to feed a Markov chain simulation.

Understanding the controls

Matrix size
Between 2 and 6 states. Each row gives the probabilities of moving from that state to every other.
Denominator
Between 10 and 1000. Larger denominators give finer probabilities; a hundred reads as percentages.
Seed
Reproduces exactly the same transition matrix.

Common use cases

  • Transition matrices for a Markov chain exercise or simulation
  • Test data where exact row sums matter
  • Showing why probabilities are better stored as fractions
  • Illustrating the difference between stochastic and doubly stochastic
  • Repeating an identical transition matrix from a seed

How this generator works

Cut points are drawn and sorted, and the gaps between them become the row's entries — a standard way to split a total into parts without bias towards any of them. The check sums each row as integers and requires exactly the denominator, and confirms the decimal view matches the fractions it came from.

Randomness and fairness

The transition probabilities are random; the row sums are exact by construction. Seeded matrices reproduce and are therefore explicitly not cryptographically secure. Unseeded, the browser's cryptographically secure generator draws the cut points.

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

Limitations and good to know

  • Right stochastic only — rows are the outgoing probabilities, which is the usual convention but not the only one.
  • Zero entries are possible, so some transitions may be impossible.
  • Doubly stochastic matrices appear only by chance and cannot be requested.
  • No stationary distribution is computed; the Markov chain simulator does that.
  • Transition matrices are not kept; seed one to feed the same chain twice.

Privacy and your data

The matrix is generated in your browser. Nothing about the probabilities or your seed is transmitted.