def choice(self, board: Union[chess.Board, int], *, minimum_weight: int = 1, exclude_moves: Container[chess.Move] = (), random=random) -> Entry:
        """
        Uniformly selects a random entry for the given position.

        :raises: :exc:`IndexError` if no entries are found.
        """
        chosen_entry = None

        for i, entry in enumerate(self.find_all(board, minimum_weight=minimum_weight, exclude_moves=exclude_moves)):
            if chosen_entry is None or random.randint(0, i) == i:
                chosen_entry = entry

        if chosen_entry is None:
            raise IndexError()

        return chosen_entry
def choice ( self , board : Union [ chess . Board , int ] , * , minimum_weight : int = 1 , exclude_moves : Container [ chess . Move ] = ( ) , random = random ) -> Entry : chosen_entry = None for i , entry in enumerate ( self . find_all ( board , minimum_weight = minimum_weight , exclude_moves = exclude_moves ) ) : if chosen_entry is None or random . randint ( 0 , i ) == i : chosen_entry = entry if chosen_entry is None : raise IndexError ( ) return chosen_entry
Uniformly selects a random entry for the given position.

        :raises: :exc:`IndexError` if no entries are found.