Fixed RAND() function