Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static randomFill(buffer: ArrayBuffer): void {
let len = buffer.byteLength;
let ptr = changetype(buffer);
while (len > 0) {
let chunk = min(len, 256);
if (random_get(ptr, chunk) != errno.SUCCESS) {
abort();
}
len -= chunk;
ptr += chunk;
}
}