{"action":"created","comment":{"url":"https://api.github.com/repos/google/rappor/pulls/comments/51960505","id":51960505,"diff_hunk":"@@ -122,36 +122,34 @@ def from_csv(f):\n class _SimpleRandom(object):\n   \"\"\"Returns an integer where each bit has probability p of being 1.\"\"\"\n \n-  def __init__(self, prob_one, num_bits, _rand=None):\n+  def __init__(self, prob_one, num_bits):\n     self.prob_one = prob_one\n     self.num_bits = num_bits\n-    self._rand = _rand or random.Random()\n \n   def __call__(self):\n     p = self.prob_one\n-    rand_fn = self._rand.random  # cache it for speed\n+    bytes = os.urandom(self.num_bits)\n \n     r = 0\n-    for i in xrange(self.num_bits):\n-      bit = rand_fn() < p\n+    for i, b in enumerate(xrange(self.num_bits)):\n+      bit = b < p * 255.0\n       r |= (bit << i)  # using bool as int\n     return r\n \n \n class SimpleIrrRand(object):","path":"client/python/rappor.py","position":null,"original_position":33,"commit_id":"f43c319a1dde47643ea20160a895c98b9f94529b","original_commit_id":"fdaf06faff2c43cb0ed09a8002b3135f36fdbc47","user":{"login":"tkaitchuck","id":4756752,"avatar_url":"https://avatars.githubusercontent.com/u/4756752?v=3","gravatar_id":"","url":"https://api.github.com/users/tkaitchuck","html_url":"https://github.com/tkaitchuck","followers_url":"https://api.github.com/users/tkaitchuck/followers","following_url":"https://api.github.com/users/tkaitchuck/following{/other_user}","gists_url":"https://api.github.com/users/tkaitchuck/gists{/gist_id}","starred_url":"https://api.github.com/users/tkaitchuck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkaitchuck/subscriptions","organizations_url":"https://api.github.com/users/tkaitchuck/orgs","repos_url":"https://api.github.com/users/tkaitchuck/repos","events_url":"https://api.github.com/users/tkaitchuck/events{/privacy}","received_events_url":"https://api.github.com/users/tkaitchuck/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2016-02-05T00:25:05Z","updated_at":"2016-02-05T00:25:05Z","html_url":"https://github.com/google/rappor/pull/69#discussion_r51960505","pull_request_url":"https://api.github.com/repos/google/rappor/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/google/rappor/pulls/comments/51960505"},"html":{"href":"https://github.com/google/rappor/pull/69#discussion_r51960505"},"pull_request":{"href":"https://api.github.com/repos/google/rappor/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/google/rappor/pulls/69","id":58209749,"html_url":"https://github.com/google/rappor/pull/69","diff_url":"https://github.com/google/rappor/pull/69.diff","patch_url":"https://github.com/google/rappor/pull/69.patch","issue_url":"https://api.github.com/repos/google/rappor/issues/69","number":69,"state":"open","locked":false,"title":"Shell cleanup","user":{"login":"tkaitchuck","id":4756752,"avatar_url":"https://avatars.githubusercontent.com/u/4756752?v=3","gravatar_id":"","url":"https://api.github.com/users/tkaitchuck","html_url":"https://github.com/tkaitchuck","followers_url":"https://api.github.com/users/tkaitchuck/followers","following_url":"https://api.github.com/users/tkaitchuck/following{/other_user}","gists_url":"https://api.github.com/users/tkaitchuck/gists{/gist_id}","starred_url":"https://api.github.com/users/tkaitchuck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkaitchuck/subscriptions","organizations_url":"https://api.github.com/users/tkaitchuck/orgs","repos_url":"https://api.github.com/users/tkaitchuck/repos","events_url":"https://api.github.com/users/tkaitchuck/events{/privacy}","received_events_url":"https://api.github.com/users/tkaitchuck/received_events","type":"User","site_admin":false},"body":"I have two changes here: \r\nThe first is to add sane defaults to the scripts and add any missing arguments and things that need to be installed. This way a user can simply run ./setup.sh && ./build.sh && ./demo.sh to go from nothing to a running demo on a clean computer.\r\n\r\nThe second is a change to the default random number generator in the python client to be cryptographically secure. This is an easy change, and shouldn't impact test performance as we default to using fast rand anyway. Bench marking it, it's about a factor of 2 slower at generating irrs, but this is worth the trade off to have users not have to implement this additional interface themselves. ","created_at":"2016-02-03T22:15:53Z","updated_at":"2016-02-05T00:25:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0adfcae6aa42224bd808612a82784c89d8efa98d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/google/rappor/pulls/69/commits","review_comments_url":"https://api.github.com/repos/google/rappor/pulls/69/comments","review_comment_url":"https://api.github.com/repos/google/rappor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/rappor/issues/69/comments","statuses_url":"https://api.github.com/repos/google/rappor/statuses/f43c319a1dde47643ea20160a895c98b9f94529b","head":{"label":"google:shellCleanup","ref":"shellCleanup","sha":"f43c319a1dde47643ea20160a895c98b9f94529b","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":25319462,"name":"rappor","full_name":"google/rappor","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/rappor","description":"RAPPOR: Privacy-Preserving Reporting Algorithms","fork":false,"url":"https://api.github.com/repos/google/rappor","forks_url":"https://api.github.com/repos/google/rappor/forks","keys_url":"https://api.github.com/repos/google/rappor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/rappor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/rappor/teams","hooks_url":"https://api.github.com/repos/google/rappor/hooks","issue_events_url":"https://api.github.com/repos/google/rappor/issues/events{/number}","events_url":"https://api.github.com/repos/google/rappor/events","assignees_url":"https://api.github.com/repos/google/rappor/assignees{/user}","branches_url":"https://api.github.com/repos/google/rappor/branches{/branch}","tags_url":"https://api.github.com/repos/google/rappor/tags","blobs_url":"https://api.github.com/repos/google/rappor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/rappor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/rappor/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/rappor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/rappor/statuses/{sha}","languages_url":"https://api.github.com/repos/google/rappor/languages","stargazers_url":"https://api.github.com/repos/google/rappor/stargazers","contributors_url":"https://api.github.com/repos/google/rappor/contributors","subscribers_url":"https://api.github.com/repos/google/rappor/subscribers","subscription_url":"https://api.github.com/repos/google/rappor/subscription","commits_url":"https://api.github.com/repos/google/rappor/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/rappor/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/rappor/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/rappor/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/rappor/contents/{+path}","compare_url":"https://api.github.com/repos/google/rappor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/rappor/merges","archive_url":"https://api.github.com/repos/google/rappor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/rappor/downloads","issues_url":"https://api.github.com/repos/google/rappor/issues{/number}","pulls_url":"https://api.github.com/repos/google/rappor/pulls{/number}","milestones_url":"https://api.github.com/repos/google/rappor/milestones{/number}","notifications_url":"https://api.github.com/repos/google/rappor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/rappor/labels{/name}","releases_url":"https://api.github.com/repos/google/rappor/releases{/id}","deployments_url":"https://api.github.com/repos/google/rappor/deployments","created_at":"2014-10-16T20:05:27Z","updated_at":"2016-02-04T20:12:18Z","pushed_at":"2016-02-05T00:24:49Z","git_url":"git://github.com/google/rappor.git","ssh_url":"git@github.com:google/rappor.git","clone_url":"https://github.com/google/rappor.git","svn_url":"https://github.com/google/rappor","homepage":"","size":1434,"stargazers_count":161,"watchers_count":161,"language":"R","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":31,"mirror_url":null,"open_issues_count":24,"forks":31,"open_issues":24,"watchers":161,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"6eb6ea11fffb4fac17977a98d6dd3705ad93483f","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":25319462,"name":"rappor","full_name":"google/rappor","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/rappor","description":"RAPPOR: Privacy-Preserving Reporting Algorithms","fork":false,"url":"https://api.github.com/repos/google/rappor","forks_url":"https://api.github.com/repos/google/rappor/forks","keys_url":"https://api.github.com/repos/google/rappor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/rappor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/rappor/teams","hooks_url":"https://api.github.com/repos/google/rappor/hooks","issue_events_url":"https://api.github.com/repos/google/rappor/issues/events{/number}","events_url":"https://api.github.com/repos/google/rappor/events","assignees_url":"https://api.github.com/repos/google/rappor/assignees{/user}","branches_url":"https://api.github.com/repos/google/rappor/branches{/branch}","tags_url":"https://api.github.com/repos/google/rappor/tags","blobs_url":"https://api.github.com/repos/google/rappor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/rappor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/rappor/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/rappor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/rappor/statuses/{sha}","languages_url":"https://api.github.com/repos/google/rappor/languages","stargazers_url":"https://api.github.com/repos/google/rappor/stargazers","contributors_url":"https://api.github.com/repos/google/rappor/contributors","subscribers_url":"https://api.github.com/repos/google/rappor/subscribers","subscription_url":"https://api.github.com/repos/google/rappor/subscription","commits_url":"https://api.github.com/repos/google/rappor/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/rappor/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/rappor/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/rappor/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/rappor/contents/{+path}","compare_url":"https://api.github.com/repos/google/rappor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/rappor/merges","archive_url":"https://api.github.com/repos/google/rappor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/rappor/downloads","issues_url":"https://api.github.com/repos/google/rappor/issues{/number}","pulls_url":"https://api.github.com/repos/google/rappor/pulls{/number}","milestones_url":"https://api.github.com/repos/google/rappor/milestones{/number}","notifications_url":"https://api.github.com/repos/google/rappor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/rappor/labels{/name}","releases_url":"https://api.github.com/repos/google/rappor/releases{/id}","deployments_url":"https://api.github.com/repos/google/rappor/deployments","created_at":"2014-10-16T20:05:27Z","updated_at":"2016-02-04T20:12:18Z","pushed_at":"2016-02-05T00:24:49Z","git_url":"git://github.com/google/rappor.git","ssh_url":"git@github.com:google/rappor.git","clone_url":"https://github.com/google/rappor.git","svn_url":"https://github.com/google/rappor","homepage":"","size":1434,"stargazers_count":161,"watchers_count":161,"language":"R","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":31,"mirror_url":null,"open_issues_count":24,"forks":31,"open_issues":24,"watchers":161,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/rappor/pulls/69"},"html":{"href":"https://github.com/google/rappor/pull/69"},"issue":{"href":"https://api.github.com/repos/google/rappor/issues/69"},"comments":{"href":"https://api.github.com/repos/google/rappor/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/google/rappor/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/google/rappor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/rappor/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/google/rappor/statuses/f43c319a1dde47643ea20160a895c98b9f94529b"}}}}