Get a series of pseudo-random letters with no repeats.
12488
def random_letters(count):
    """"""
    rv = random.choice(string.ascii_uppercase)
    while len(rv) < count:
        l = random.choice(string.ascii_uppercase)
        if not l in rv:
            rv += l
    return rv
276526
def _sequence(self, i):
        """"""

        result = ['[']
        end_range = 0
        escape_hyphen = -1
        removed = False
        last_posix = False

        c = next(i)
        if c in ('!', '^'):
            # Handle negate char
            result.append('^')
            c = next(i)
        if c == '[':
            last_posix = self._handle_posix(i, result, 0)
            if not last_posix:
                result.append(re.escape(c))
            c = next(i)
        elif c in ('-', ']'):
            result.append(re.escape(c))
            c = next(i)

        while c != ']':
            if c == '-':
                if last_posix:
                    result.append('\\' + c)
                    last_posix = False
                elif i.index - 1 > escape_hyphen:
                    # Found a range delimiter.
                    # Mark the next two characters as needing to be escaped if hyphens.
                    # The next character would be the end char range (s-e),
                    # and the one after that would be the potential start char range
                    # of a new range (s-es-e), so neither can be legitimate range delimiters.
                    result.append(c)
                    escape_hyphen = i.index + 1
                    end_range = i.index
                elif end_range and i.index - 1 >= end_range:
                    if self._sequence_range_check(result, '\\' + c):
                        removed = True
                    end_range = 0
                else:
                    result.append('\\' + c)
                c = next(i)
                continue
            last_posix = False

            if c == '[':
                last_posix = self._handle_posix(i, result, end_range)
                if last_posix:
                    c = next(i)
                    continue

            if c == '\\':
                # Handle escapes
                subindex = i.index
                try:
                    value = self._references(i, True)
                except PathNameException:
                    raise StopIteration
                except StopIteration:
                    i.rewind(i.index - subindex)
                    value = r'\\'
            elif c == '/':
                if self.pathname:
                    raise StopIteration
                value = c
            elif c in SET_OPERATORS:
                # Escape &, |, and ~ to avoid &&, ||, and ~~
                value = '\\' + c
            else:
                # Anything else
                value = c

            if end_range and i.index - 1 >= end_range:
                if self._sequence_range_check(result, value):
                    removed = True
                end_range = 0
            else:
                result.append(value)

            c = next(i)

        result.append(']')
        # Bad range removed.
        if removed:
            value = "".join(result)
            if value == '[]':
                # We specified some ranges, but they are all
                # out of reach.  Create an impossible sequence to match.
                result = ['[^%s]' % ('\x00-\xff' if self.is_bytes else uniprops.UNICODE_RANGE)]
            elif value == '[^]':
                # We specified some range, but hey are all
                # out of reach. Since this is exclusive
                # that means we can match *anything*.
                result = ['[%s]' % ('\x00-\xff' if self.is_bytes else uniprops.UNICODE_RANGE)]
            else:
                result = [value]

        if self.pathname or self.after_start:
            return self._restrict_sequence() + ''.join(result)

        return ''.join(result)
673287
def rand_ascii_str(length):
    
    letters = [random.choice(ascii_letters_and_digits) for _ in range(length)]
    return ''.join(letters)
238435
def rand_str(max_len=6):
    
    v = [x for x in NUM_LETTER_STR]
    np.random.shuffle(v)
    return ''.join(v[:max_len])
676871
def get_random_word(dictionary, starting_letter=None):
    
    if starting_letter is None:
        starting_letter = random.choice(list(dictionary.keys()))

    try:
        to_return = random.choice(dictionary[starting_letter])
    except KeyError:
        msg = "Dictionary does not contain a word starting with '{}'"
        raise NoWordForLetter(msg.format(starting_letter))

    return to_return
1334960
def random_str(size=10):
    
    return ''.join(random.choice(string.ascii_lowercase) for _ in range(size))
949620
def random_string(**kwargs):
    
    n = kwargs.get('length', 10)
    pool = kwargs.get('pool') or string.digits + string.ascii_lowercase
    return ''.join(random.SystemRandom().choice(pool) for _ in range(n))
110735
def getRandomSequence(length=500):
    
    fastaHeader = ""
    for i in xrange(int(random.random()*100)):
        fastaHeader = fastaHeader + random.choice([ 'A', 'C', '0', '9', ' ', '\t' ])
    return (fastaHeader, \
            "".join([ random.choice([ 'A', 'C', 'T', 'G', 'A', 'C', 'T', 'G', 'A', 'C', 'T', 'G', 'A', 'C', 'T', 'G', 'A', 'C', 'T', 'G', 'N' ]) for i in xrange((int)(random.random() * length))]))
765029
def random_string(length, charset):
    
    n = len(charset)
    return ''.join(charset[random.randrange(n)] for _ in range(length))
1093990
def random_from_alphabet(size, alphabet):
    
    import random
    return list(random.choice(alphabet) for _ in range(size))
428224
function getRandomColors() {
    var letters = '0123456789ABCDEF'.split('');
    var _color = '#';
    for (var i = 0; i < 6; i++) {
        _color += letters[Math.floor(Math.random() * 16)];
    }
    return _color;
}
694444
def simulate(self):
        
        min_ = 1 if self._min is None else self._min
        max_ = 10 if self._max is None else self._max
        n = min_ if (min_ >= max_) else random.randint(min_, max_)
        chars = string.ascii_letters + string.digits
        return ''.join(random.choice(chars) for x in range(n))
371982
def repeat_str(state):
    """"""
    if state == const.REPEAT_STATE_OFF:
        return 'Off'
    if state == const.REPEAT_STATE_TRACK:
        return 'Track'
    if state == const.REPEAT_STATE_ALL:
        return 'All'
    return 'Unsupported'
600763
def randomprune(self,n):
        """"""
        self.data = random.sample(self.data, n)
492973
def rand_str(charset, length=32):
    
    return "".join([random.choice(charset) for _ in range(length)])
412844
public static String getRandomString(int numberOfLetters, char[] alphabet, boolean includeNumbers) {
        StringBuilder builder = new StringBuilder();
        
        int upperRange = alphabet.length - 1;
        
        // make sure first character is not a number
        builder.append(alphabet[generator.nextInt(upperRange)]);
        
        if (includeNumbers) {
            upperRange += NUMBERS.length;
        }
        
        for (int i = 1; i < numberOfLetters; i++) {
            int letterIndex = generator.nextInt(upperRange);
            
            if (letterIndex > alphabet.length - 1) {
                builder.append(NUMBERS[letterIndex - alphabet.length]);
            } else {
                builder.append(alphabet[letterIndex]);
            }
        }
        
        return builder.toString();
    }
1133977
def _make_nonce(self):
        '''
        
        '''

        chars = string.digits + string.ascii_letters
        nonce = ''.join(random.choice(chars) for i in range(25))

        if self._logging:
            utils.log('nonce created: %s' % nonce)

        return nonce