updated randstream method