# Alfonso Subiotto Marqués - (Mostly) Deterministic Simulation Testing in Go (Highlights)
%20Deterministic%20Simulation%20Testing%20in%20Go&authors=Alfonso%20Subiotto%20Marqu%C3%A9s&tags=Testing,Go,FrostDB,Golang,Debugging,Databases,Deterministic%20Simulation%20Testing)
## Metadata
**Review**:: [readwise.io](https://readwise.io/bookreview/61299488)
**Source**:: #from/readwise #from/reader
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Alfonso Subiotto Marqués]]
**Full Title**:: (Mostly) Deterministic Simulation Testing in Go
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**Document Tags**:: #via/ddia
**URL**:: [www.polarsignals.com](https://www.polarsignals.com/blog/posts/2024/05/28/mostly-dst-in-go)
**Host**:: [[www.polarsignals.com]]
**Highlighted**:: [[2026-06-13]]
**Created**:: [[2026-06-20]]
## Highlights
- At this point a bit of pattern-matching occurred and we recalled that it was possible to compile Go programs to WASM and run them on a [WASM runtime](https://go.dev/blog/wasi) that implements the WebAssembly syscall interface (wasip1). ([View Highlight](https://read.readwise.io/read/01kv1fnpzjamk7tkzdtx44m489)) ^1025008288
- Thankfully, all random choices in the runtime use a global random number generator seeded at startup, including the rand package exposed to the Go application. This seed is [read using the OS-specific `readRandom` function](https://github.com/golang/go/blob/35ef4a9f330fdff870ff637558ec2fd03a93fd9c/src/runtime/rand.go#L51). There is no way to provide this seed at startup, so we ended up modifying the Go runtime to read the seed via an environment variable. ([View Highlight](https://read.readwise.io/read/01kv1fqxky5szk3dcc3g7zd2c4)) ^1025010162
- The key idea is that time starts at a fixed timestamp and only advances when all goroutines are blocked. ([View Highlight](https://read.readwise.io/read/01kv1fsry4hyd7gqnsrcmeyqbm)) ^1025011615