Skip to content

Commit 4c26913

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 6540e99 commit 4c26913

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
@@ -1540,7 +1540,8 @@ console.log(
15401540
`${buf.length} bytes of random data: ${buf.toString('hex')}`);
15411541
```
15421542

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

0 commit comments

Comments
 (0)