Ruby's Louvre

每天学习一点点算法

导航

通过window.crypto.getRandomValues获得一个大于零的随机数

window.crypto.getRandomValues(new Uint32Array(1))[0];

浏览器支持情况如下:

IE: no
IE Mobile: no

Firefox24+

Firefox Mobile: will be in 21

Safari: from 3.1

Safari Mobile: from iOS 6

Chrome: from 11

Chrome for Mobile: from 23
Android browser (before 4.0 as replaced with Chrome): no

Opera: no (though will probably get it when moving to WebKit)

Opera Mobile: no
Opera Mini: no

posted on 2013-12-07 09:46  司徒正美  阅读(6290)  评论(0编辑  收藏  举报