Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GamePicker idempotent #23

Closed
Serneum opened this issue Oct 17, 2016 · 0 comments
Closed

Make GamePicker idempotent #23

Serneum opened this issue Oct 17, 2016 · 0 comments

Comments

@Serneum
Copy link
Member

Serneum commented Oct 17, 2016

iex(26)> val = :crypto.hash(:sha256, "2016/10/17") |> Base.encode16
"745CF20C8C37778697493B917C4B9F11BFE8A55B4B1322AE63FABDCB13ABB9D4"
iex(28)> {hash, _} = Integer.parse(val, 16)
{52632510926520334323601098306284332410336972837482672690491232650717471422932,
 ""}
iex(29)> rem hash, 9
2
iex(40)> Date.to_string(DateTime.to_date(DateTime.utc_now()))
"2016-10-17"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant