--- title: RandomSource slug: Web/API/RandomSource translation_of: Web/API/Crypto/getRandomValues translation_of_original: Web/API/RandomSource ---
{{APIRef("Web Crypto API")}}
RandomSource 代表密码学安全随机数的来源。它可以通过全局对象的 {{domxref("Crypto")}} 获取:网页中的 {{domxref("Window.crypto")}},Workrt 里面的 {{domxref("WorkerGlobalScope.crypto")}}。
RandomSource 不是一个接口,这个类型的对象不可以被创建。
RandomSource 既没有定义也没有属性。
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('Web Crypto API', '#dfn-RandomSource')}} | {{Spec2('Web Crypto API')}} | Initial definition |
{{ CompatibilityTable() }}
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 11.0 {{ webkitbug("22049") }} | {{CompatVersionUnknown}} | {{CompatGeckoDesktop(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 | {{ CompatNo() }} | 23 | {{CompatVersionUnknown}} | {{CompatGeckoMobile(21)}} | {{ CompatNo() }} | {{ CompatNo() }} | 6 |
[1] Although the transparent RandomSource is only available since Firefox 26, the feature was available in Firefox 21.