Add randomList() method to Cheeses dummy data class

Change-Id: If0bc908360f3509928001ffdb0e8ee9758c0168a
diff --git a/common/src/java/com/example/android/common/dummydata/Cheeses.java b/common/src/java/com/example/android/common/dummydata/Cheeses.java
index a386e68..220d66a 100644
--- a/common/src/java/com/example/android/common/dummydata/Cheeses.java
+++ b/common/src/java/com/example/android/common/dummydata/Cheeses.java
@@ -17,6 +17,8 @@
 package com.example.android.common.dummydata;
 
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Random;
 
 /**
  * Dummy data.
@@ -162,4 +164,20 @@
         }
         return items;
     }
-}
\ No newline at end of file
+
+    /**
+     * Return a list of random cheeses.
+     *
+     * @param count the amount of cheeses to return.
+     */
+    public static ArrayList<String> randomList(int count) {
+        Random random = new Random();
+        HashSet<String> items = new HashSet<String>();
+
+        while (items.size() < count) {
+            items.add(CHEESES[random.nextInt(CHEESES.length)]);
+        }
+
+        return new ArrayList<String>(items);
+    }
+}