This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def get_random_hex_by_length(length=4): | |
"""Returns a random hex code according to length""" | |
return hex(random.randint((16**((length)-1)),(16**length)))[2:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_max_combination(length, base=16): | |
current = base**(length-1) | |
next = base**(length) | |
return next-current |