2016-09-27 14:48:21 +00:00
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def uniform(n: int) -> int:
|
|
|
|
'''
|
|
|
|
Compute uniform random number from interval 0 ... n - 1
|
|
|
|
'''
|
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def bytes(len: int) -> bytes:
|
|
|
|
'''
|
|
|
|
Generate random bytes sequence of length len
|
|
|
|
'''
|
|
|
|
|
2017-04-08 16:43:26 +00:00
|
|
|
# extmod/modtrezorcrypto/modtrezorcrypto-random.h
|
2016-09-27 14:48:21 +00:00
|
|
|
def shuffle(data: list) -> None:
|
|
|
|
'''
|
|
|
|
Shuffles items of given list (in-place)
|
|
|
|
'''
|