in packages/random-source-browser/src/index.ts [12:23]
export function randomValues(byteLength: number): Promise<Uint8Array> {
// Find the global scope for this runtime
const globalScope = locateWindow();
if (supportsWebCrypto(globalScope)) {
return webCryptoRandomValues(byteLength);
} else if (isMsWindow(globalScope)) {
return ie11RandomValues(byteLength);
}
return Promise.reject(new Error(`Unable to locate a secure random source.`));
}