satella.random.shuffle_together(*args) → List[List[T]]

args, being sequences of equal length, will be permuted in such a way that their indices will still correspond to each other.

So given:

>>> a = [1, 2, 3]
>>> b = ['a', 'b', 'c']
>>> c = shuffle_together(a, b)

Might equal

>>> c == [[3, 1, 2], ['c', 'a', 'b']]


satella.random.random_binary(length: int) → bytes

Return a random bytes string of given length.

An attempt will be made to utilize /dev/random, if exists

Parameters:length – length of string to generate


satella.random.random_word(length: int, choice: Sequence[T] = 'abcdefghijklmnopqrstuvwxyz', join_fun: Callable[[List[T]], T] = <function <lambda>>) → Sequence[T]

Build and return a random word of provided length.

The word will be built by calling join_fun with length of arguments picked at random from choice.

Best used with strings. Provide a word length, a string to choose from as choice (defaults to string.ascii_lowercase). Will return by default a string (which coincidentally happens to be a sequence of strings, albeit one-character ones).

  • length – length of the word
  • choice – a range of characters to use. By default is string.ascii_lowercase
  • join_fun – an argument to be called with a list of randomly picked values. Defaults to ‘’.join(args), so your T must be a string. If you’re passing a different type, remember to alter this function because the default one expects strings!

a random word