convert int_to_bytes to little endian

This commit is contained in:
Danny Ryan 2019-02-02 16:41:59 -08:00
parent 04b37f266c
commit 2a32e7f665
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 3 additions and 3 deletions

View File

@ -710,8 +710,8 @@ def shuffle(values: List[Any], seed: Bytes32) -> List[Any]:
if remaining == 1:
break
# Read 3-bytes of `source` as a 24-bit big-endian integer.
sample_from_source = int.from_bytes(source[position:position + rand_bytes], 'big')
# Read 3-bytes of `source` as a 24-bit little-endian integer.
sample_from_source = int.from_bytes(source[position:position + rand_bytes], 'little')
# Sample values greater than or equal to `sample_max` will cause
# modulo bias when mapped into the `remaining` range.
@ -1015,7 +1015,7 @@ def is_power_of_two(value: int) -> bool:
### `int_to_bytes1`, `int_to_bytes2`, ...
`int_to_bytes1(x): return x.to_bytes(1, 'big')`, `int_to_bytes2(x): return x.to_bytes(2, 'big')`, and so on for all integers, particularly 1, 2, 3, 4, 8, 32, 48, 96.
`int_to_bytes1(x): return x.to_bytes(1, 'little')`, `int_to_bytes2(x): return x.to_bytes(2, 'little')`, and so on for all integers, particularly 1, 2, 3, 4, 8, 32, 48, 96.
### `get_effective_balance`