Use faster rand() instead of M_RandomInt()