deterministic

Always producing the same result from the same inputs, with nothing left to chance or timing.

In more detail

Deterministic code gives the same answer every run, which makes it testable and reproducible. Clocks, random numbers, hash randomisation, networks and the order of concurrent work are common sources of non-determinism.

Examples

A hash function must be deterministic, or a hash table could never find a key again.
Screenshot tests need deterministic rendering: frozen animations, loaded fonts, a fixed viewport and one operating system image.
In the browser: The cascade is deterministic thanks to source order as the final tie-breaker, and IndexedDB schema upgrades are deterministic because each version number runs a fixed set of steps.
Build fingerprints sort file paths so identical code always hits the cache.
Go: t.TempDir() gives each test its own temporary folder
The course sorts records and fixes timestamps so every run prints the same output; Kafka's key partitioner is deterministic too.
In Terraform: Terraform's built-in functions are deterministic, so the same inputs always produce the same plan. Values that must be random, such as passwords, come from the random provider and are stored in state so they stay stable.
In this course: Clocks, random numbers, shared databases, networks and run order all make tests non-deterministic. Make those inputs explicit and fixed, and the test gives the same verdict every time.

Related terms

Taught in

References

Certification courses