def filter_random_sample(self, candidates, criterion):
        """ Returns a random sample from the initial list.
            It supports policy `size` and `ratio` features.
        """
        if not criterion:
            return []
        size = criterion.get("size")
        if size is None:
            ratio = criterion.get("ratio", 1)
            size = int(len(candidates)*ratio)
        if size == 0:
            self.logger.debug("RandomSample size 0")
            return []
        if size > len(candidates):
            return candidates
        return random.sample(candidates, size)
 Returns a random sample from the initial list.
            It supports policy `size` and `ratio` features.
        
powerfulseal/policy/action_nodes_pods.py