internal helper method to pick a random route from the table.
344698
protected Map.Entry<TrustGraphNodeId,TrustGraphNodeId> randomRoute() {
        final int routeNumber = rng.nextInt(routingTable.size()); 
        final Iterator<Map.Entry<TrustGraphNodeId,TrustGraphNodeId>> routes =
                routingTable.entrySet().iterator();
        for (int i = 0; i < routeNumber; i++) { routes.next(); }
        return routes.next();
    }
7685
def get_random_proxy(self):
        """"""
        idx = randint(0, len(self._list) - 1)
        return self._list[idx]
215870
public static <T> T getRandomSelection(T... options) {
        if (options == null || options.length == 0) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "No options provided to random selection, returning null");
            }
            return null;
        }
        if (options.length == 1) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Only one option provided to random selection, returning it: [" + options[0] + "]");
            }
            return options[0];
        }

        Random rand = new Random();
        Integer index = rand.nextInt(options.length);

        T entry = options[index];
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "Chose random selection: [" + ((entry == null) ? null : entry) + "]");
        }
        return entry;
    }
1369627
private List<T> randomChoose(List<T> servers, int toChoose) {
        int size = servers.size();
        if (toChoose >= size || toChoose < 0) {
            return servers;
        } 
        for (int i = 0; i < toChoose; i++) {
            int index = random.nextInt(size);
            T tmp = servers.get(index);
            servers.set(index, servers.get(i));
            servers.set(i, tmp);
        }
        return servers.subList(0, toChoose);        
    }
952424
private int randomWithRankedValues(IntVar x) {
        TIntArrayList[] values = new TIntArrayList[ranks.length];

        DisposableValueIterator ite = x.getValueIterator(true);
        try {
            while (ite.hasNext()) {
                int v = ite.next();
                int i;

                for (i = 0; i < ranks.length; i++) {
                    if (ranks[i].contains(v)) {
                        if (values[i] == null) {
                            values[i] = new TIntArrayList();
                        }
                        values[i].add(v);
                    }
                }
            }
        } finally {
            ite.dispose();
        }

        //We pick a random value in the first rank that is not empty (aka null here)
        for (TIntArrayList rank : values) {
            if (rank != null) {
                int v = rnd.nextInt(rank.size());
                return rank.get(v);
            }
        }
        return -1;
    }
533157
def random_connection(self):
        ''''''
        # While at the moment there's no need for this to be a context manager
        # per se, I would like to use that interface since I anticipate
        # adding some wrapping around it at some point.
        yield random.choice(
            [conn for conn in self.connections() if conn.alive()])
952708
public static <T> T pickRandom (T[] values)
    {
        return (values == null || values.length == 0) ? null : values[getInt(values.length)];
    }
506655
def choose_one(things):
    """"""
    choice = SystemRandom().randint(0, len(things) - 1)
    return things[choice].strip()
955332
def randpath(self):
        
        return '/'.join(
            gen_rand_str(3, 10, use=self.random, keyspace=list(self.keyspace))
            for _ in range(self.random.randint(0, 3)))
697492
def selectisinstance(table, field, value, complement=False):
    """"""

    return selectop(table, field, value, isinstance, complement=complement)
74614
def randomTraversal(sensations, numTraversals):
    
    newSensations = []
    for _ in range(numTraversals):
      s = copy.deepcopy(sensations)
      random.shuffle(s)
      newSensations += s
    return newSensations
636143
def random_draft(card_class: CardClass, exclude=[]):
	
	from . import cards
	from .deck import Deck

	deck = []
	collection = []
	# hero = card_class.default_hero

	for card in cards.db.keys():
		if card in exclude:
			continue
		cls = cards.db[card]
		if not cls.collectible:
			continue
		if cls.type == CardType.HERO:
			# Heroes are collectible...
			continue
		if cls.card_class and cls.card_class not in [card_class, CardClass.NEUTRAL]:
			# Play with more possibilities
			continue
		collection.append(cls)

	while len(deck) < Deck.MAX_CARDS:
		card = random.choice(collection)
		if deck.count(card.id) < card.max_count_in_deck:
			deck.append(card.id)

	return deck
277303
public static void randomPathFast(int[] result, int size) {
        //Random generator = new Random();

        for (int i = 0; i < size; i++) result[i] = i;
        for (int k = size - 1; k > 0; k--) {
            int w = (int)Math.floor(Math.random() * (k+1));
            int temp = result[w];
            result[w] = result[k];
            result[k] = temp;
        }
    }
983683
def rowlenselect(table, n, complement=False):
    """"""

    where = lambda row: len(row) == n
    return select(table, where, complement=complement)
581628
def get_random(self):
        
        available = list(self.unchecked | self.good)
        if not available:
            return None
        return random.choice(available)
895219
def select_action(self, nb_actions, probs):
        
        action = np.random.choice(range(nb_actions), p=probs)
        return action
268157
def offer_random(pool, answer, rationale, student_id, options):
    
    offer_simple(pool, answer, rationale, student_id, options)