Skip to content

Commit acd54a8

Browse files
committed
readme
1 parent a1d8791 commit acd54a8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ is designed to feel like a Convex action but with a few restrictions:
116116
1. The workflow runs in the background, so it can't return a value.
117117
2. The workflow must be _deterministic_, so it should implement most of its logic
118118
by calling out to other Convex functions. We restrict access to some
119-
non-deterministic functions like `Math.random()` and `fetch`. Others we
120-
patch, such as `console` for logging and `Date` for time.
119+
non-deterministic functions like `fetch` and `crypto`. Others we patch, such
120+
as `console` for logging, `Math.random()` (seeded PRNG) and `Date` for time.
121121

122122
Note: To help avoid type cycles, always annotate the return type of the `handler`
123123
with the return type of the workflow.
@@ -470,8 +470,10 @@ Here are a few limitations to keep in mind:
470470
(including the workflow state overhead). See more about mutation limits here:
471471
https://docs.convex.dev/production/state/limits#transactions
472472
- We currently do not collect backtraces from within function calls from workflows.
473-
- If you need to use side effects like `fetch` or use randomness,
473+
- If you need to use side effects like `fetch` or use cryptographic randomness,
474474
you'll need to do that in a step, not in the workflow definition.
475+
- `Math.random` is deterministic and not suitable for cryptographic use. It is,
476+
however, useful for sharding, jitter, and other pseudo-random applications.
475477
- If the implementation of the workflow meaningfully changes (steps added,
476478
removed, or reordered) then it will fail with a determinism violation.
477479
The implementation should stay stable for the lifetime of active workflows.

0 commit comments

Comments
 (0)