Your favorite mt_rand or array_rand

Hi, if you could use only one forever for arrays, would you choose to use mt_rand or array_rand… I know it depends on what you’re doing, but if you could use for arrays for the best random item, and couldn’t use the other, which one would you choose? Even if it means you might have to use a little more code, which one would you use. Please let me know I can’t decide which one I’d rather use for a fix on something. I’m thinking mt_rand, since I’ve heard it’s supposed to be better for arrays than the other, but I’m not positive if that is true after reading about them. Why I am asking you that have used them a lot, which one you would choose if could only choose one forever, for a better random item. Thank you.

Since neither of them exists in JavaScript, I can’t really say.

In PHP, I like to use shuffle(), which internally uses rand().

Whoops thank you.

New thread started with this question in the PHP forum: http://www.sitepoint.com/forums/showthread.php?t=712729

Thread closed.