Von Neuman在1940年提出了平方取中法,其原理是将一个给定的2n比特的数平方,然后高位补0得到4n比特的数,再截取中间的2n位进行下次迭代,并得到一个随机数序列。这种方法无论是在硬件实现上,还是在仿真测试上都比较容易实现,但是它的周期受初始值的影响很大,如果初始值选得不好,会严重影响随机数序列的质量和周期,而且其最大周期不会超过22n
随机数生成
SHOW FULL COLUMNS FROM `jrk_downrecords` [ RunTime:0.001490s ]
SELECT `a`.`aid`,`a`.`title`,`a`.`create_time`,`m`.`username` FROM `jrk_downrecords` `a` INNER JOIN `jrk_member` `m` ON `a`.`uid`=`m`.`id` WHERE `a`.`status` = 1 GROUP BY `a`.`aid` ORDER BY `a`.`create_time` DESC LIMIT 10 [ RunTime:0.090603s ]
SHOW FULL COLUMNS FROM `jrk_tagrecords` [ RunTime:0.001001s ]
SELECT * FROM `jrk_tagrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 20 [ RunTime:0.001115s ]
SHOW FULL COLUMNS FROM `jrk_member` [ RunTime:0.000955s ]
SELECT `id`,`username`,`userhead`,`usertime` FROM `jrk_member` WHERE `status` = 1 ORDER BY `usertime` DESC LIMIT 10 [ RunTime:0.003247s ]
SHOW FULL COLUMNS FROM `jrk_searchrecords` [ RunTime:0.001351s ]
SELECT * FROM `jrk_searchrecords` WHERE `status` = 1 ORDER BY `num` DESC LIMIT 5 [ RunTime:0.004871s ]
SELECT aid,title,count(aid) as c FROM `jrk_downrecords` GROUP BY `aid` ORDER BY `c` DESC LIMIT 10 [ RunTime:0.014784s ]
SHOW FULL COLUMNS FROM `jrk_articles` [ RunTime:0.001041s ]
UPDATE `jrk_articles` SET `hits` = 2 WHERE `id` = 444352 [ RunTime:0.010164s ]