Setting a Static Seed for Random in Tests

Heya, silly question with probably a very easy answer - I'm trying to set a static seed for Random in tests, I assumed that I could just override the Random.Random tag like this:

Effect.runFork(
  Effect.gen(function* () {
    const n = yield* Random.next
    yield* Console.log(n)
  }).pipe(Effect.provideService(Random.Random, Random.make('test'))),
)


(where the stuff in the gen in reality is my entire server/API program)

I would expect this to print the same number every time this is executed, but it doesn't - how can I override the built-in services instead?

(Separately, I would really appreciate a page in the docs about the actual APIs exposed by the built-in services, the "Default Services" docs page only tells us that they exist, but not what their APIs are or how to override these if needed 🙂
Was this page helpful?