array_rand 是否使用 Mersenne Twister 算法? [英] Does array_rand use the Mersenne Twister algorithm?
问题描述
在 PHP 中,我们可以选择 mt_rand() 和rand() 其中 mt_rand()
使用梅森Twister 算法和 rand()
使用 libc 随机生成器.
In PHP, we have the choice of mt_rand() and rand() where mt_rand()
uses the Mersenne Twister algorithm and rand()
uses the libc random generator.
我想使用 array_rand一>.但是,array_rand
是否使用 Mersenne Twister 算法?
I would like to choose a random item out of an array using array_rand. However, does array_rand
use the Mersenne Twister algorithm?
使用 mt_rand
实现我自己的 array_rand
非常简单,但如果 array_rand 使用 Mersenne Twister,那就更好了.
It is quite simple to implement my own array_rand
using mt_rand
, but if array_rand uses the Mersenne Twister, then all the better.
推荐答案
看来 array_rand
使用 php_rand()
内部,这似乎是 good 旧的非 mt 版本.
It appears that array_rand
uses php_rand()
internally, which appears to be the good old non-mt version.
这篇关于array_rand 是否使用 Mersenne Twister 算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!