Skip to content

Commit a06d129

Browse files
sam-githubMylesBorins
authored andcommitted
doc: crypto.randomBytes does not block when async
It may not return random bytes right away, but when called asynchronously it will not block. PR-URL: #14993 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 503370e commit a06d129

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/api/crypto.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,8 @@ console.log(
17131713
`${buf.length} bytes of random data: ${buf.toString('hex')}`);
17141714
```
17151715

1716-
The `crypto.randomBytes()` method will block until there is sufficient entropy.
1716+
The `crypto.randomBytes()` method will not complete until there is
1717+
sufficient entropy available.
17171718
This should normally never take longer than a few milliseconds. The only time
17181719
when generating the random bytes may conceivably block for a longer period of
17191720
time is right after boot, when the whole system is still low on entropy.

0 commit comments

Comments
 (0)