This commit is contained in:
Peter D. Gray 2018-04-13 14:15:36 -04:00
parent 46f859757e
commit 2d00aa1aa1

View File

@ -14,8 +14,7 @@
/// Compute uniform random number from interval 0 ... n - 1.
/// '''
STATIC mp_obj_t mod_trezorcrypto_random_uniform(mp_obj_t n) {
// XXX tc.random.uniform(34359738369) always == 0
uint32_t nn = mp_obj_get_int_truncated(n);
uint32_t nn = mp_obj_int_get_checked(n);
if (nn == 0) {
mp_raise_ValueError("Maximum can't be zero");
}