txt: ## pickpairs.md
  pickpairs
  
  Combined from primary sources listed below.
  
  # [In role Baggy](#___top "go to top of document")[§](#(role_Baggy)_method_pickpairs "direct link")
  
  See primary documentation
  [in context](/type/Baggy#method_pickpairs)
  for **method pickpairs**.
  
  ```raku
  multi method pickpairs(Baggy:D: --> Pair:D)
  multi method pickpairs(Baggy:D: $count --> Seq:D)
  ```
  
  Returns a [`Pair`](/type/Pair) or a [`Seq`](/type/Seq) of [`Pair`](/type/Pair)s depending on the version of the method being invoked. Each [`Pair`](/type/Pair) returned has an element of the invocant as its key and the element's weight as its value. The elements are 'picked' without replacement. If `*` is passed as `$count`, or `$count` is greater than or equal to the number of [elements](#method_elems) of the invocant, then all element/weight [`Pair`](/type/Pair)s from the invocant are returned in a random sequence.
  
  Note that each `pickpairs` invocation maintains its own private state and has no effect on subsequent `pickpairs` invocations.
  
  ```raku
  my $breakfast = bag <eggs bacon bacon bacon>;
  say $breakfast.pickpairs;                         # OUTPUT: «eggs => 1␤»
  say $breakfast.pickpairs(1);                      # OUTPUT: «(bacon => 3)␤»
  say $breakfast.pickpairs(*);                      # OUTPUT: «(eggs => 1 bacon => 3)␤»
  ```
  
  # [In role Setty](#___top "go to top of document")[§](#(role_Setty)_method_pickpairs "direct link")
  
  See primary documentation
  [in context](/type/Setty#method_pickpairs)
  for **method pickpairs**.
  
  ```raku
  multi method pickpairs(Setty:D: --> Pair:D)
  multi method pickpairs(Setty:D: $count --> Seq:D)
  ```
  
  Returns a [`Pair`](/type/Pair) or a [`Seq`](/type/Seq) of [`Pair`](/type/Pair)s depending on the candidate of the method being invoked. Each [`Pair`](/type/Pair) returned has an element of the invocant as its key and `True` as its value. In contrast to [grabpairs](#method_grabpairs), the elements are 'picked' without replacement.
  
  If `*` is passed as `$count`, or `$count` is greater than or equal to the number of [elements](#method_elems) of the invocant, then all element/`True` [`Pair`](/type/Pair)s from the invocant are returned in a random sequence; i.e. they are returned shuffled;
  
  Note that each `pickpairs` invocation maintains its own private state and has no effect on subsequent `pickpairs` invocations.
  
  ```raku
  my $numbers = set (4, 2, 3);
  say $numbers.pickpairs;                           # OUTPUT: «4 => True␤»
  say $numbers.pickpairs(1);                        # OUTPUT: «(3 => True)␤»
  say $numbers.pickpairs(*);                        # OUTPUT: «(2 => True 4 => True 3 => True)␤»
  ```
  