-
-
Save makmac213/4671646 to your computer and use it in GitHub Desktop.
Return a random hex code
This file contains 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:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment