getRandomShoppingCategories function

ShoppingCategory getRandomShoppingCategories (
  1. List<CreditCard> cards
)

Implementation

ShoppingCategory getRandomShoppingCategories(List<CreditCard> cards) {
  List<ShoppingCategory> categories = getUniqueShoppingCategories(cards);
  Random randomGenerator = Random();
  return categories[randomGenerator.nextInt(categories.length)];
}