more efficient uses of rand