Skip to content

Instantly share code, notes, and snippets.

@mortie
Created October 9, 2016 19:51
Show Gist options
  • Save mortie/100469058081fc47c7afe4ccf17c28fd to your computer and use it in GitHub Desktop.
Save mortie/100469058081fc47c7afe4ccf17c28fd to your computer and use it in GitHub Desktop.
def color_fn_weighted_random(x):
if x == 0:
x = 101
x = 101 - x
x = min(int((x / 101) * 255), 255)
arr = [
min(randint(int(x // 4), x), 255),
min(randint(int(x // 4), x), 255),
min(randint(int(x // 4), x), 255)]
arr[randint(0, 2)] *= 4
return arr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment