From 4c26913dab7e9201154a15a90f29161468b3ad2a Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 23 Aug 2017 14:04:33 -0700 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/14993 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- doc/api/crypto.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index a40178db22..79c7a3c733 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1540,7 +1540,8 @@ console.log( `${buf.length} bytes of random data: ${buf.toString('hex')}`); ``` -The `crypto.randomBytes()` method will block until there is sufficient entropy. +The `crypto.randomBytes()` method will not complete until there is +sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.