This won't work if `window.crypto` is undefined. You want
```javascript
'crypto' in window && 'getRandomValues' in window.crypto
```