Skip to content

Instantly share code, notes, and snippets.

@chinskiy
Last active June 4, 2019 09:23
Show Gist options
  • Select an option

  • Save chinskiy/0918e2661a028435773d00051c825e67 to your computer and use it in GitHub Desktop.

Select an option

Save chinskiy/0918e2661a028435773d00051c825e67 to your computer and use it in GitHub Desktop.
def get_flag_value(flag_name, uid, pct=50):
random = Random()
if six.PY2:
random.seed("%s-%s" % (uid, flag_name))
else:
random.seed("%s-%s" % (uid, flag_name), version=1)
return int(random.random() * 100) + 1 <= pct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment