JS 随机数

参考:https://www.cnblogs.com/wisewrong/p/10517532.html

参考知乎回答:https://www.zhihu.com/question/22818104

 

1. random, 伪随机数

2.sort重排,取其中

3.洗牌算法

4.9301, 49297, 233280神数字,线性同余生成器,Hull-Dobell定理

var rand = (function(){ 
   var seed = (new Date()).getTime();
   function r(){ 
        seed = (seed*9301+49297)%233280 
        return seed/(233280.0) 
   } 
   return function(number){ 
         return Math.ceil(r()*number) 
    }
 })()

 

上一篇:有没有办法在python中回读随机种子?


下一篇:Program-Adaptive Mutational Fuzzing IEEE S&P(Oakland) 2015 论文解读