Mega Code Archive

 
Categories / Java Book / 005 Collection
 

0341 Rotate and shuffle a list

static void rotate(List<?> list, int distance) Rotates the elements in the specified list by the specified distance. static void shuffle(List<?> list) Randomly permutes the specified list using a default source of randomness. static void shuffle(List<?> list, Random rnd) Randomly permute the specified list using the specified source of randomness.