rand() function for positions