Test-data tools often include a field called a seed. If you generate 100 rows with seed 42 and later use seed 42 again with the same generator and processing conditions, the same data may be reproduced. That can look contradictory: if the data is random, why does it come back exactly the same?

The reason is that much of the randomness used in software is pseudorandom. Instead of creating an entirely unpredictable value from scratch for every item, a deterministic algorithm repeatedly transforms internal state into a sequence that looks random. The seed determines where that process starts.

Four pieces of reproducible randomness

PRNG

Pseudorandom values are computed

The values look irregular, but each next value is produced by a defined computation. Starting from the same state produces the same computation results.

Seed

The seed chooses the starting point

The seed is used to initialize the generator's state. If the same seed is initialized in the same way, the generator can follow the same sequence.

State

Each draw advances the state

Every draw updates internal state. One extra random draw in the middle can shift every value that follows.

Reproduce

Matching conditions reproduce the result

Reproducibility depends on more than the seed: the algorithm, configuration, source data, and processing order must also stay compatible.

Random-looking does not mean calculation-free

Software uses several kinds of randomness. For test data, games, and simulations, a pseudorandom number generator (PRNG) is common. A PRNG keeps internal state, computes the next value from that state, updates the state, and repeats.

The important property here is determinism. Applying the same computation to the same internal state produces the same next value. A sequence can look irregular to a person while still being a predictable progression of states to the generator.

A seed is not the first random number; it initializes state

A seed is an input used to decide the generator's starting state. The seed itself is not necessarily the first random output. Many implementations transform the seed into internal state and generate the sequence from there.

If the same seed is passed to the same algorithm using the same initialization method, the starting state matches. If random values are then consumed in the same order, the first, second, third, and later outputs can be reproduced.

How a seed advances internal state (conceptual diagram)
Seed 42 Initial state S0 Random value 1 State S1 Random value 2 State S2 Random value 3

Use one extra random value in the middle → every later value shifts by one step

Test-data generators turn the random sequence into field values

A test-data generator usually does not display raw PRNG outputs. It maps them into useful values: one draw might choose a name, another a date, and another might decide whether a field becomes missing, boundary, or invalid data.

That is why reproducibility depends on more than the seed. Column order, row count, per-column configuration, candidate dictionaries, and missing/boundary/invalid-value rates also matter. Even with the same underlying random sequence, changing the mapping rules changes the final dataset.

When can the same seed produce different results?

The seed is central to reproducibility, but saving only the seed does not guarantee identical output forever. Results can shift when the generator algorithm changes, random draws are consumed in a different order, a new column introduces an extra draw, or a candidate dictionary is updated.

Passing the same numeric seed to a different library or programming language also does not guarantee the same sequence. JavaScript's Math.random() returns pseudorandom values, but ECMAScript leaves its algorithm implementation-defined, and the standard API does not let callers choose or reset its seed. Applications that need reproducibility therefore use a generator with explicit seeding behavior.

A seed can turn a one-off failure into a reproducible test

Seeds are valuable in testing because they let you preserve an accidental failure. Suppose a bug appears only for one combination among 100,000 generated rows. If you record the seed and configuration, you can reconstruct that input later and compare behavior before and after a fix.

Without reproducibility, a failure found yesterday may disappear today simply because the generated data changed. A seed does not remove randomness from exploration; it gives you a way to return to one particular exploration result.

Browser Kitty's Test Data Generator treats the seed and configuration together

Browser Kitty's Test Data Generator can reproduce output from the same seed, configuration, and row count. If the seed field is left blank, the tool creates a seed during generation and shows the value that was used. The row count, seed, and column configuration can also be saved as a settings file.

The important part is to keep the configuration together with the seed. A report that says only 'seed 42 failed' is less reproducible than one that also records the column setup, missing-value rates, row count, and seed.

Reproducible randomness and security randomness serve different goals

In testing, being able to regenerate the same values is useful. For passwords, session tokens, encryption keys, and similar security-sensitive data, the important property is that an attacker should not be able to infer future values from observed output or internal state. General-purpose PRNGs used for tests are not designed to provide that cryptographic unpredictability.

That is why a test PRNG should not be reused as a security random source. MDN warns that Math.random() is not cryptographically secure and points developers to Web Crypto APIs such as Crypto.getRandomValues() when cryptographically strong random values are needed. The same word, random, refers to different goals: reproducibility in tests and resistance to prediction in security.

Four things to keep the same for reproducibility

If you want to reproduce seeded test data later, keep these four items together rather than recording only the seed.

  1. SeedThis is the value used to return to the same starting state. Record the actual seed in bug reports and test cases.
  2. Generator and versionChanging the PRNG algorithm or application implementation can change the sequence even with the same seed. Record the application version when long-term reproduction matters.
  3. Configuration and source dataKeep the column definitions, ranges, candidate values, missing-value rates, and boundary/invalid-value settings that map random draws into final data.
  4. Call order and row countChanging the order or number of random draws changes how generator state advances. Column order, row count, and newly inserted processing steps can all affect the result.
Try it in Browser Kitty

Test Data Generator

Generate reproducible test data locally with configurable columns, row count, Seed, and optional missing, boundary, or invalid values.

Open toolView tool details

Tips and limitations

  • A seed is not a measure of how random the output is. A larger seed does not make the sequence more random.

Frequently asked questions

Does the same seed always produce exactly the same data?

Not from the seed alone. The generator algorithm, initialization method, configuration, candidate data, and order and number of random draws must remain compatible. A new application version can change output even if the numeric seed is unchanged.

Does changing the seed guarantee a completely different dataset?

A different seed normally selects a different pseudorandom sequence, but some final values can still coincide. If a field has only three candidates, different seeds can naturally choose the same candidate on some rows. Different seeds do not imply that every output value will be unique.

Can I just give a seed to Math.random()?

Not through the standard JavaScript API. The implementation chooses the initial seed for Math.random(), and callers cannot set or reset it. Reproducible applications use a separate PRNG with explicit seeding support.

If I save the seed, can I avoid saving a million generated rows?

For reconstructing generated test data, storing the seed and configuration can be effective. But changes to generation logic, dictionaries, or application versions can alter the output. If the exact historical dataset is required as an audit artifact, the seed alone is not a substitute for retaining that dataset.

Should I use a seeded PRNG to generate passwords?

A general-purpose seeded PRNG used for reproducible tests should not be reused as a security random source. Such generators are not designed to guarantee cryptographic resistance to prediction from observed output or internal state. On the web, use cryptographic randomness such as the Web Crypto API when the use case requires it.

References

The explanation of pseudorandomness, seeded reproducibility, JavaScript's Math.random(), and security-oriented randomness is based on the following specifications and official documentation. Because reproducibility depends on the generator and implementation, this article does not claim that a numeric seed alone guarantees identical output forever.