{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/comments/224370805","pull_request_review_id":163716613,"id":224370805,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDM3MDgwNQ==","diff_hunk":"@@ -324,36 +324,39 @@ def shuffle(values: List[Any],\n     \"\"\"\n     values_count = len(values)\n \n-    # entropy is consumed in 3 byte chunks\n-    # sample_max is defined to remove the modulo bias from this entropy source\n-    sample_max = 2 ** 24\n-    assert values_count <= sample_max\n+    # Entropy is consumed from the seed in 3-byte (24 bit) chunks.\n+    rand_max = 2 ** 24 - 1\n+    assert values_count < rand_max\n \n     output = [x for x in values]\n     source = seed\n     index = 0\n-    while index < values_count:\n+    while index < values_count - 1:\n         # Re-hash the source\n         source = hash(source)","path":"specs/beacon-chain.md","position":18,"original_position":18,"commit_id":"6700f283d5c7da9b052000019e572f90b4fc8220","original_commit_id":"6700f283d5c7da9b052000019e572f90b4fc8220","user":{"login":"JustinDrake","id":731743,"node_id":"MDQ6VXNlcjczMTc0Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/731743?v=4","gravatar_id":"","url":"https://api.github.com/users/JustinDrake","html_url":"https://github.com/JustinDrake","followers_url":"https://api.github.com/users/JustinDrake/followers","following_url":"https://api.github.com/users/JustinDrake/following{/other_user}","gists_url":"https://api.github.com/users/JustinDrake/gists{/gist_id}","starred_url":"https://api.github.com/users/JustinDrake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustinDrake/subscriptions","organizations_url":"https://api.github.com/users/JustinDrake/orgs","repos_url":"https://api.github.com/users/JustinDrake/repos","events_url":"https://api.github.com/users/JustinDrake/events{/privacy}","received_events_url":"https://api.github.com/users/JustinDrake/received_events","type":"User","site_admin":false},"body":"Out of curiosity, why are we rehashing the source? Isn't it sufficient to use `seed` as is?","created_at":"2018-10-11T09:05:34Z","updated_at":"2018-10-11T09:19:30Z","html_url":"https://github.com/ethereum/eth2.0-specs/pull/65#discussion_r224370805","pull_request_url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/comments/224370805"},"html":{"href":"https://github.com/ethereum/eth2.0-specs/pull/65#discussion_r224370805"},"pull_request":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65","id":222019668,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMDE5NjY4","html_url":"https://github.com/ethereum/eth2.0-specs/pull/65","diff_url":"https://github.com/ethereum/eth2.0-specs/pull/65.diff","patch_url":"https://github.com/ethereum/eth2.0-specs/pull/65.patch","issue_url":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/65","number":65,"state":"open","locked":false,"title":"Fix shuffle() function errors","user":{"login":"paulhauner","id":6660660,"node_id":"MDQ6VXNlcjY2NjA2NjA=","avatar_url":"https://avatars2.githubusercontent.com/u/6660660?v=4","gravatar_id":"","url":"https://api.github.com/users/paulhauner","html_url":"https://github.com/paulhauner","followers_url":"https://api.github.com/users/paulhauner/followers","following_url":"https://api.github.com/users/paulhauner/following{/other_user}","gists_url":"https://api.github.com/users/paulhauner/gists{/gist_id}","starred_url":"https://api.github.com/users/paulhauner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulhauner/subscriptions","organizations_url":"https://api.github.com/users/paulhauner/orgs","repos_url":"https://api.github.com/users/paulhauner/repos","events_url":"https://api.github.com/users/paulhauner/events{/privacy}","received_events_url":"https://api.github.com/users/paulhauner/received_events","type":"User","site_admin":false},"body":"I updated the `shuffle()` function as discussed in #55.\r\n\r\nThe following changes were implemented:\r\n\r\n1. `sample_max` was made distinct from `rand_max`. \r\n2. `rand_max` now represents the greatest value returned by the RNG\r\ninstead of the length of the range. This is consistent with the [cstdlib RAND_MAX constant](http://www.cplusplus.com/reference/cstdlib/RAND_MAX/).\r\n3. `while` condition fixed to stop infinite loop.\r\n4. Comments updated.\r\n\r\nAfter fixing (2) I noticed that there was an error in generating `sample_max` caused by `rand_max` being too high. **This affects the output of the shuffle.** All clients should update their shuffler if this PR is accepted.\r\n\r\nI have used the [shuffling_sandbox](https://github.com/sigp/shuffling_sandbox/) to fuzz this code against my [reference implementation](https://github.com/sigp/shuffling_sandbox/blob/master/src/shufflers/reference.py).","created_at":"2018-10-11T06:25:50Z","updated_at":"2018-10-11T09:19:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dced99cd46e15f1a333ebd0a68755870bf0b5caf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65/commits","review_comments_url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65/comments","review_comment_url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/65/comments","statuses_url":"https://api.github.com/repos/ethereum/eth2.0-specs/statuses/6700f283d5c7da9b052000019e572f90b4fc8220","head":{"label":"sigp:shuffling_update","ref":"shuffling_update","sha":"6700f283d5c7da9b052000019e572f90b4fc8220","user":{"login":"sigp","id":22672004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjcyMDA0","avatar_url":"https://avatars1.githubusercontent.com/u/22672004?v=4","gravatar_id":"","url":"https://api.github.com/users/sigp","html_url":"https://github.com/sigp","followers_url":"https://api.github.com/users/sigp/followers","following_url":"https://api.github.com/users/sigp/following{/other_user}","gists_url":"https://api.github.com/users/sigp/gists{/gist_id}","starred_url":"https://api.github.com/users/sigp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigp/subscriptions","organizations_url":"https://api.github.com/users/sigp/orgs","repos_url":"https://api.github.com/users/sigp/repos","events_url":"https://api.github.com/users/sigp/events{/privacy}","received_events_url":"https://api.github.com/users/sigp/received_events","type":"Organization","site_admin":false},"repo":{"id":149846859,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk4NDY4NTk=","name":"eth2.0-specs","full_name":"sigp/eth2.0-specs","private":false,"owner":{"login":"sigp","id":22672004,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIyNjcyMDA0","avatar_url":"https://avatars1.githubusercontent.com/u/22672004?v=4","gravatar_id":"","url":"https://api.github.com/users/sigp","html_url":"https://github.com/sigp","followers_url":"https://api.github.com/users/sigp/followers","following_url":"https://api.github.com/users/sigp/following{/other_user}","gists_url":"https://api.github.com/users/sigp/gists{/gist_id}","starred_url":"https://api.github.com/users/sigp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigp/subscriptions","organizations_url":"https://api.github.com/users/sigp/orgs","repos_url":"https://api.github.com/users/sigp/repos","events_url":"https://api.github.com/users/sigp/events{/privacy}","received_events_url":"https://api.github.com/users/sigp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sigp/eth2.0-specs","description":"Ethereum 2.0 Specifications","fork":true,"url":"https://api.github.com/repos/sigp/eth2.0-specs","forks_url":"https://api.github.com/repos/sigp/eth2.0-specs/forks","keys_url":"https://api.github.com/repos/sigp/eth2.0-specs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sigp/eth2.0-specs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sigp/eth2.0-specs/teams","hooks_url":"https://api.github.com/repos/sigp/eth2.0-specs/hooks","issue_events_url":"https://api.github.com/repos/sigp/eth2.0-specs/issues/events{/number}","events_url":"https://api.github.com/repos/sigp/eth2.0-specs/events","assignees_url":"https://api.github.com/repos/sigp/eth2.0-specs/assignees{/user}","branches_url":"https://api.github.com/repos/sigp/eth2.0-specs/branches{/branch}","tags_url":"https://api.github.com/repos/sigp/eth2.0-specs/tags","blobs_url":"https://api.github.com/repos/sigp/eth2.0-specs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sigp/eth2.0-specs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sigp/eth2.0-specs/git/refs{/sha}","trees_url":"https://api.github.com/repos/sigp/eth2.0-specs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sigp/eth2.0-specs/statuses/{sha}","languages_url":"https://api.github.com/repos/sigp/eth2.0-specs/languages","stargazers_url":"https://api.github.com/repos/sigp/eth2.0-specs/stargazers","contributors_url":"https://api.github.com/repos/sigp/eth2.0-specs/contributors","subscribers_url":"https://api.github.com/repos/sigp/eth2.0-specs/subscribers","subscription_url":"https://api.github.com/repos/sigp/eth2.0-specs/subscription","commits_url":"https://api.github.com/repos/sigp/eth2.0-specs/commits{/sha}","git_commits_url":"https://api.github.com/repos/sigp/eth2.0-specs/git/commits{/sha}","comments_url":"https://api.github.com/repos/sigp/eth2.0-specs/comments{/number}","issue_comment_url":"https://api.github.com/repos/sigp/eth2.0-specs/issues/comments{/number}","contents_url":"https://api.github.com/repos/sigp/eth2.0-specs/contents/{+path}","compare_url":"https://api.github.com/repos/sigp/eth2.0-specs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sigp/eth2.0-specs/merges","archive_url":"https://api.github.com/repos/sigp/eth2.0-specs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sigp/eth2.0-specs/downloads","issues_url":"https://api.github.com/repos/sigp/eth2.0-specs/issues{/number}","pulls_url":"https://api.github.com/repos/sigp/eth2.0-specs/pulls{/number}","milestones_url":"https://api.github.com/repos/sigp/eth2.0-specs/milestones{/number}","notifications_url":"https://api.github.com/repos/sigp/eth2.0-specs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sigp/eth2.0-specs/labels{/name}","releases_url":"https://api.github.com/repos/sigp/eth2.0-specs/releases{/id}","deployments_url":"https://api.github.com/repos/sigp/eth2.0-specs/deployments","created_at":"2018-09-22T04:58:36Z","updated_at":"2018-10-11T04:23:36Z","pushed_at":"2018-10-11T05:59:28Z","git_url":"git://github.com/sigp/eth2.0-specs.git","ssh_url":"git@github.com:sigp/eth2.0-specs.git","clone_url":"https://github.com/sigp/eth2.0-specs.git","svn_url":"https://github.com/sigp/eth2.0-specs","homepage":null,"size":166,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ethereum:master","ref":"master","sha":"1684a3ffd3e9dbbea6efca454ac194b3ce693429","user":{"login":"ethereum","id":6250754,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTA3NTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6250754?v=4","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":149554797,"node_id":"MDEwOlJlcG9zaXRvcnkxNDk1NTQ3OTc=","name":"eth2.0-specs","full_name":"ethereum/eth2.0-specs","private":false,"owner":{"login":"ethereum","id":6250754,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYyNTA3NTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6250754?v=4","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ethereum/eth2.0-specs","description":"Ethereum 2.0 Specifications","fork":false,"url":"https://api.github.com/repos/ethereum/eth2.0-specs","forks_url":"https://api.github.com/repos/ethereum/eth2.0-specs/forks","keys_url":"https://api.github.com/repos/ethereum/eth2.0-specs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/eth2.0-specs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/eth2.0-specs/teams","hooks_url":"https://api.github.com/repos/ethereum/eth2.0-specs/hooks","issue_events_url":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/eth2.0-specs/events","assignees_url":"https://api.github.com/repos/ethereum/eth2.0-specs/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/eth2.0-specs/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/eth2.0-specs/tags","blobs_url":"https://api.github.com/repos/ethereum/eth2.0-specs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/eth2.0-specs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/eth2.0-specs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/eth2.0-specs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/eth2.0-specs/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/eth2.0-specs/languages","stargazers_url":"https://api.github.com/repos/ethereum/eth2.0-specs/stargazers","contributors_url":"https://api.github.com/repos/ethereum/eth2.0-specs/contributors","subscribers_url":"https://api.github.com/repos/ethereum/eth2.0-specs/subscribers","subscription_url":"https://api.github.com/repos/ethereum/eth2.0-specs/subscription","commits_url":"https://api.github.com/repos/ethereum/eth2.0-specs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/eth2.0-specs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/eth2.0-specs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/eth2.0-specs/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/eth2.0-specs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/eth2.0-specs/merges","archive_url":"https://api.github.com/repos/ethereum/eth2.0-specs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/eth2.0-specs/downloads","issues_url":"https://api.github.com/repos/ethereum/eth2.0-specs/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/eth2.0-specs/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/eth2.0-specs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/eth2.0-specs/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/eth2.0-specs/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/eth2.0-specs/deployments","created_at":"2018-09-20T05:12:54Z","updated_at":"2018-10-11T08:26:09Z","pushed_at":"2018-10-11T06:25:51Z","git_url":"git://github.com/ethereum/eth2.0-specs.git","ssh_url":"git@github.com:ethereum/eth2.0-specs.git","clone_url":"https://github.com/ethereum/eth2.0-specs.git","svn_url":"https://github.com/ethereum/eth2.0-specs","homepage":null,"size":188,"stargazers_count":57,"watchers_count":57,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"archived":false,"open_issues_count":21,"license":null,"forks":16,"open_issues":21,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65"},"html":{"href":"https://github.com/ethereum/eth2.0-specs/pull/65"},"issue":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/65"},"comments":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/eth2.0-specs/statuses/6700f283d5c7da9b052000019e572f90b4fc8220"}},"author_association":"NONE"}}
{"actor":{"display_login":"JustinDrake"}}