rnd direction function with seed added