MCPcopy Create free account
hub / github.com/cryptii/cryptii / nextBytes

Method nextBytes

src/Random.js:62–72  ·  view source on GitHub ↗

* Returns next given number of bytes. * @param {number} size Amount of bytes to produce * @return {Uint8Array}

(size)

Source from the content-addressed store, hash-verified

60 * @return {Uint8Array}
61 */
62 nextBytes (size) {
63 const bytes = new Uint8Array(size)
64 if (this._crypto) {
65 this._crypto.getRandomValues(bytes)
66 } else {
67 for (let i = 0; i < size; i++) {
68 bytes[i] = this.nextInteger(0, 0xFF)
69 }
70 }
71 return bytes
72 }
73
74 /**
75 * Returns next boolean value.

Callers 1

randomizeValueMethod · 0.80

Calls 1

nextIntegerMethod · 0.95

Tested by

no test coverage detected