fixed shuffle function to use proper rng