Package Crypto :: Package Random :: Module random
[frames] | no frames]

Module random

A cryptographically strong version of Python's standard "random" module.
Classes
  StrongRandom
Functions
 
getrandbits(k)
Return a python long integer with k random bits.
 
randrange(*args)
randrange([start,] stop[, step]): Return a randomly-selected element from range(start, stop, step).
 
randint(a, b)
Return a random integer N such that a <= N <= b.
 
choice(seq)
Return a random element from a (non-empty) sequence.
 
shuffle(x)
Shuffle the sequence in place.
 
sample(population, k)
Return a k-length list of unique elements chosen from the population sequence.
Function Details

choice(seq)

 

Return a random element from a (non-empty) sequence.

If the seqence is empty, raises IndexError.