mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 20:19:23 +00:00
fix int param for crypto.random.uniform()
This commit is contained in:
parent
605ba30bd6
commit
5c02718c58
@ -25,7 +25,7 @@ STATIC mp_obj_t mod_TrezorCrypto_Random_make_new(const mp_obj_type_t *type, size
|
|||||||
/// Compute uniform random number from interval 0 ... n - 1
|
/// Compute uniform random number from interval 0 ... n - 1
|
||||||
/// '''
|
/// '''
|
||||||
STATIC mp_obj_t mod_TrezorCrypto_Random_uniform(mp_obj_t self, mp_obj_t n) {
|
STATIC mp_obj_t mod_TrezorCrypto_Random_uniform(mp_obj_t self, mp_obj_t n) {
|
||||||
uint32_t nn = mp_obj_get_int(n);
|
uint32_t nn = mp_obj_get_int_truncated(n);
|
||||||
if (nn == 0) {
|
if (nn == 0) {
|
||||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Maximum can't be zero"));
|
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, "Maximum can't be zero"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user