Answer by Mitchell McKenna for What is the most ideal, cross-language method of executing an A/B split?

July 10 2011, 2:49pm

You should use mt_rand() over rand(). It's 4x faster than rand() because it uses a Mersenne Twister over the libc random number generator (see

You can then get an equivalent to mt_rand() for javascript from the php.js library.