| 1 |
:mod:`Crypto.Random` package |
| 2 |
============================ |
| 3 |
|
| 4 |
.. function:: Crypto.Random.get_random_bytes(N) |
| 5 |
|
| 6 |
Return a random byte string of length *N*. |
| 7 |
|
| 8 |
:mod:`Crypto.Random.random` module |
| 9 |
---------------------------------- |
| 10 |
|
| 11 |
.. function:: Crypto.Random.random.getrandbits(N) |
| 12 |
|
| 13 |
Return a random integer, at most *N* bits long. |
| 14 |
|
| 15 |
.. function:: Crypto.Random.random.randrange([start,] stop[, step]) |
| 16 |
|
| 17 |
Return a random integer in the range *(start, stop, step)*. |
| 18 |
By default, *start* is 0 and *step* is 1. |
| 19 |
|
| 20 |
.. function:: Crypto.Random.random.randint(a, b) |
| 21 |
|
| 22 |
Return a random integer in the range no smaller than *a* |
| 23 |
and no larger than *b*. |
| 24 |
|
| 25 |
.. function:: Crypto.Random.random.choice(seq) |
| 26 |
|
| 27 |
Return a random element picked from the sequence *seq*. |
| 28 |
|
| 29 |
.. function:: Crypto.Random.random.shuffle(seq) |
| 30 |
|
| 31 |
Randomly shuffle the sequence *seq* in-place. |
| 32 |
|
| 33 |
.. function:: Crypto.Random.random.sample(population, k) |
| 34 |
|
| 35 |
Randomly chooses *k* distinct elements from the list *population*. |