Implementing Dario's random ordering.