GenerateRandomSearch

Logic Gate Circuit Generator

A small circuit of AND, OR, XOR and NOT gates, where every gate may take earlier gates as inputs and none may feed itself. The interesting property is that a circuit and a formula are two views of the same function — so this page derives both and requires them to agree on every input combination. If they ever disagreed, one of the two would be wrong and the page would say so.

What this generator does

Builds a chain of gates where each one draws its inputs from the circuit's inputs or from gates already defined, so the result is acyclic by construction. The last gate is the output, and the same function is also assembled as an expression for cross-checking.

How to use this tool

  1. Choose how many inputs and how many gates.
  2. Trace the signal through the gates for each input combination.
  3. Compare your table against the one shown.
  4. Read the equivalent expression to see the same circuit written algebraically.

Understanding the controls

How many inputs
Between 2 and 4. The table covers every input combination, so four inputs is already sixteen rows.
How many gates
Between 2 and 8. More gates means more reuse of earlier outputs, which is what makes tracing interesting.
Seed
Reproduces the same circuit exactly, wiring and gate types alike, so a traced answer can be checked later.

Common use cases

  • Digital logic practice with the answer table given
  • Showing the correspondence between a circuit and a boolean formula
  • Test instances for a circuit simulator
  • Tracing signals by hand through a small network of gates
  • Producing the same circuit twice from a seed

How this generator works

Gates only ever reference earlier gates, which removes any possibility of feedback. The check confirms that structural property, that every gate has the right number of inputs for its type, and — the substantive test — that evaluating the circuit and evaluating its expression give the same answer on every input combination.

Randomness and fairness

The gate types and their wiring are random; the output table follows deterministically. Seeded circuits reproduce exactly and are therefore explicitly not cryptographically secure, and unseeded ones use the browser's cryptographically secure generator.

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

Limitations and good to know

  • Combinational circuits only — no flip-flops, no memory, no clock.
  • Gates are AND, OR, XOR and NOT. NAND and NOR are not generated, though every circuit here could be rebuilt from them.
  • The circuit is listed as gate equations rather than drawn as a diagram.
  • No attempt is made to minimise the circuit; that is the Karnaugh map's job.
  • Circuits are not stored between visits.

Privacy and your data

The circuit and its table are computed in your browser. Nothing about the circuit or your seed leaves the page.