RandomSource

RandomSource 代表密码学安全随机数的来源。它可以通过全局对象的 Crypto 获取:网页中的 Window.crypto,Workrt 里面的 WorkerGlobalScope.crypto

RandomSource 不是一个接口,这个类型的对象不可以被创建。

属性

RandomSource 既没有定义也没有属性。

方法

RandomSource.getRandomValues()
使用密码学可靠的随机值填充传递过来的 ArrayBufferView

标准

Specification Status Comment
Web Cryptography API Recommendation Initial definition

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 11.0 WebKit bug 22049 (Yes) 21 (21) [1] 11.0 15.0 3.1
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 23 (Yes) 21.0 (21) 未实现 未实现 6

[1] Although the transparent RandomSource is only available since Firefox 26, the feature was available in Firefox 21.

参见