const getRandomValues = ( buf ) : Uint8Array => { if ( typeof window === 'object' ) { const crypto = window . crypto || ( window as any ) . msCrypto as Crypto ; return crypto . getRandomValues ( buf ) ; } else if ( typeof self === 'object' && typeof self . crypto === 'object' && typeof self . crypto . getRandomValues === 'function' ) { const crypto = self . crypto ; return crypto . getRandomValues ( buf ) ; } else { const crypto = require ( 'crypto' ) ; return crypto . randomFillSync ( buf ) ; } } ; export default getRandomValues ;