pick a move at random from the list of moves
506547
def _next_move_direction(self):
        
        nmoves = len(self.moves)
        move = np.random.randint(1, nmoves+1)
        while self.prev_move == (move + 3) % nmoves:
            move = np.random.randint(1, nmoves+1)
        self.prev_move = move
        return np.array(self.moves[move])
581628
def get_random(self):
        
        available = list(self.unchecked | self.good)
        if not available:
            return None
        return random.choice(available)
1261899
def shuffle_sattolo(items):
    """"""
    _randrange = random.randrange
    for i in reversed(range(1, len(items))):
        j = _randrange(i)  # 0 <= j < i
        items[j], items[i] = items[i], items[j]
701546
def rand_elem(seq, n=None):
    """"""
    return map(random.choice, repeat(seq, n) if n is not None else repeat(seq))
1212271
def _choice_from(self, key: str) -> str:
        """"""
        data = self._data[key]
        return self.random.choice(data)
1031515
def shuffle(self, *args):
        
        call_args = list(args)
        self.random.shuffle(call_args)
        return ''.join(call_args)
293523
def pick_random_target(self):
        
        start_x = math.floor(self.grd.grid_height/2)
        start_y = math.floor(self.grd.grid_width /2)
        min_dist_from_x = 3
        min_dist_from_y = 5
        move_random_x = randint(1, math.floor(self.grd.grid_height/2))
        move_random_y = randint(1, math.floor(self.grd.grid_width/2))
        x = start_x + move_random_x - min_dist_from_x
        y = start_y + move_random_y - min_dist_from_y
        return [x,y]
806338
def _calc_all_possible_moves(self, input_color):
        
        for piece in self:

            # Tests if square on the board is not empty
            if piece is not None and piece.color == input_color:

                for move in piece.possible_moves(self):

                    test = cp(self)
                    test_move = Move(end_loc=move.end_loc,
                                     piece=test.piece_at_square(move.start_loc),
                                     status=move.status,
                                     start_loc=move.start_loc,
                                     promoted_to_piece=move.promoted_to_piece)
                    test.update(test_move)

                    if self.king_loc_dict is None:
                        yield move
                        continue

                    my_king = test.piece_at_square(self.king_loc_dict[input_color])

                    if my_king is None or \
                            not isinstance(my_king, King) or \
                            my_king.color != input_color:
                        self.king_loc_dict[input_color] = test.find_king(input_color)
                        my_king = test.piece_at_square(self.king_loc_dict[input_color])

                    if not my_king.in_check(test):
                        yield move
1115747
function random$1(data, K) {
                const rand = new Picker$1(data);
                var ans = new Array(K);

                for (var i = 0; i < K; ++i) {
                    ans[i] = rand.pick();
                }
                return ans;
            }
1084387
def random_combination(iterable, r):
    ""
    pool = tuple(iterable)
    n = len(pool)
    indices = sorted(random.sample(xrange(n), r))
    return tuple(pool[i] for i in indices)
485626
def randomize(length=6, choices=None):
    """"""
    if type(choices) == str:
        choices = list(choices)
    choices = choices or ascii_lowercase
    return "".join(choice(choices) for _ in range(length))
728903
function pick(from, picks, defaults) {
    picks = picks || [];
    defaults = defaults || {};

    var obj = {};
    for (var n=0; n<picks.length; n++) obj[picks[n]] = from[picks[n]] || defaults[picks[n]];
    return obj;
  }
59745
def find_random(self, **kwargs):
        
        import random
        max = self.count(**kwargs)
        if max:
            num = random.randint(0, max - 1)
            return next(self.find(**kwargs).skip(num))
156255
function (items) {
            for (var i = items.length - 1; i > 0; i--) {
                var j = Math.floor(Math.random() * (i + 1));
                util.swap(items, i, j);
            }
        }
764858
def do_random(context, seq):
    """"""
    try:
        return random.choice(seq)
    except IndexError:
        return context.environment.undefined('No random item, sequence was empty.')
195884
def select_action(self, next_action_arr, next_q_arr):
        '''
        
        '''
        key_arr = self.select_action_key(next_action_arr, next_q_arr)
        return next_action_arr[key_arr], next_q_arr[key_arr]
120459
def possible_moves(self, position):
        
        for move in itertools.chain(*[self.moves_in_direction(fn, position) for fn in self.cross_fn]):
            yield move