extmod/modurandom: Add "urandom" module.

Seedable and reproducible pseudo-random number generator. Implemented
functions are getrandbits(n) (n <= 32) and seed().

The algorithm used is Yasmarang by Ilya Levin:
http://www.literatecode.com/yasmarang
This commit is contained in:
Paul Sokolovsky
2016-01-17 12:10:28 +02:00
parent e7bee6b35e
commit a58a91eb04
8 changed files with 109 additions and 0 deletions

View File

@@ -671,3 +671,9 @@ Q(count)
#if MICROPY_PY_OS_DUPTERM
Q(dupterm)
#endif
#if MICROPY_PY_URANDOM
Q(urandom)
Q(getrandbits)
Q(seed)
#endif