We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c273944 commit d32363fCopy full SHA for d32363f
doc/api/crypto.markdown
@@ -651,13 +651,8 @@ Generates cryptographically strong pseudo-random data. Usage:
651
});
652
653
// sync
654
- try {
655
- var buf = crypto.randomBytes(256);
656
- console.log('Have %d bytes of random data: %s', buf.length, buf);
657
- } catch (ex) {
658
- // handle error
659
- // most likely, entropy sources are drained
660
- }
+ const buf = crypto.randomBytes(256);
+ console.log('Have %d bytes of random data: %s', buf.length, buf);
661
662
NOTE: This will block if there is insufficient entropy, although it should
663
normally never take longer than a few milliseconds. The only time when this
0 commit comments