{"action":"created","comment":{"url":"https://api.github.com/repos/gonum/stat/pulls/comments/31686343","id":31686343,"diff_hunk":"@@ -0,0 +1,98 @@\n+// Copyright ©2015 The gonum Authors. All rights reserved.\n+// Use of this code is governed by a BSD-style\n+// license that can be found in the LICENSE file\n+\n+package sample\n+\n+import \"math/rand\"\n+\n+// Weighted provides sampling without replacement from a collection of items with\n+// weighted probabilites.\n+type Weighted struct {\n+\tweights []float64\n+\theap    []float64","path":"sample/weighted.go","position":13,"original_position":13,"commit_id":"5016f5097b14a650bb00c9e893d5bd235521f2f7","original_commit_id":"5016f5097b14a650bb00c9e893d5bd235521f2f7","user":{"login":"kortschak","id":275221,"avatar_url":"https://avatars.githubusercontent.com/u/275221?v=3","gravatar_id":"","url":"https://api.github.com/users/kortschak","html_url":"https://github.com/kortschak","followers_url":"https://api.github.com/users/kortschak/followers","following_url":"https://api.github.com/users/kortschak/following{/other_user}","gists_url":"https://api.github.com/users/kortschak/gists{/gist_id}","starred_url":"https://api.github.com/users/kortschak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kortschak/subscriptions","organizations_url":"https://api.github.com/users/kortschak/orgs","repos_url":"https://api.github.com/users/kortschak/repos","events_url":"https://api.github.com/users/kortschak/events{/privacy}","received_events_url":"https://api.github.com/users/kortschak/received_events","type":"User","site_admin":false},"body":"The docs for container heap are pretty close.","created_at":"2015-06-04T01:09:26Z","updated_at":"2015-06-04T01:09:26Z","html_url":"https://github.com/gonum/stat/pull/43#discussion_r31686343","pull_request_url":"https://api.github.com/repos/gonum/stat/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/gonum/stat/pulls/comments/31686343"},"html":{"href":"https://github.com/gonum/stat/pull/43#discussion_r31686343"},"pull_request":{"href":"https://api.github.com/repos/gonum/stat/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/gonum/stat/pulls/43","id":36889188,"html_url":"https://github.com/gonum/stat/pull/43","diff_url":"https://github.com/gonum/stat/pull/43.diff","patch_url":"https://github.com/gonum/stat/pull/43.patch","issue_url":"https://api.github.com/repos/gonum/stat/issues/43","number":43,"state":"open","locked":false,"title":"stat/sample: add weighted sampler","user":{"login":"kortschak","id":275221,"avatar_url":"https://avatars.githubusercontent.com/u/275221?v=3","gravatar_id":"","url":"https://api.github.com/users/kortschak","html_url":"https://github.com/kortschak","followers_url":"https://api.github.com/users/kortschak/followers","following_url":"https://api.github.com/users/kortschak/following{/other_user}","gists_url":"https://api.github.com/users/kortschak/gists{/gist_id}","starred_url":"https://api.github.com/users/kortschak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kortschak/subscriptions","organizations_url":"https://api.github.com/users/kortschak/orgs","repos_url":"https://api.github.com/users/kortschak/repos","events_url":"https://api.github.com/users/kortschak/events{/privacy}","received_events_url":"https://api.github.com/users/kortschak/received_events","type":"User","site_admin":false},"body":"@btracey \r\n\r\nPTAL when you have time.\r\n\r\nI can add sample with replacement at a later stage as method Choose([]int) which would fill the []int with n samples.","created_at":"2015-06-03T23:30:45Z","updated_at":"2015-06-04T01:09:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a308134634b9cc5339ffef576d548169422f98c9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/gonum/stat/pulls/43/commits","review_comments_url":"https://api.github.com/repos/gonum/stat/pulls/43/comments","review_comment_url":"https://api.github.com/repos/gonum/stat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gonum/stat/issues/43/comments","statuses_url":"https://api.github.com/repos/gonum/stat/statuses/5016f5097b14a650bb00c9e893d5bd235521f2f7","head":{"label":"gonum:weighted","ref":"weighted","sha":"5016f5097b14a650bb00c9e893d5bd235521f2f7","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":22622955,"name":"stat","full_name":"gonum/stat","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/stat","description":"Statistics package for Go","fork":false,"url":"https://api.github.com/repos/gonum/stat","forks_url":"https://api.github.com/repos/gonum/stat/forks","keys_url":"https://api.github.com/repos/gonum/stat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/stat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/stat/teams","hooks_url":"https://api.github.com/repos/gonum/stat/hooks","issue_events_url":"https://api.github.com/repos/gonum/stat/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/stat/events","assignees_url":"https://api.github.com/repos/gonum/stat/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/stat/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/stat/tags","blobs_url":"https://api.github.com/repos/gonum/stat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/stat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/stat/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/stat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/stat/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/stat/languages","stargazers_url":"https://api.github.com/repos/gonum/stat/stargazers","contributors_url":"https://api.github.com/repos/gonum/stat/contributors","subscribers_url":"https://api.github.com/repos/gonum/stat/subscribers","subscription_url":"https://api.github.com/repos/gonum/stat/subscription","commits_url":"https://api.github.com/repos/gonum/stat/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/stat/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/stat/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/stat/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/stat/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/stat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/stat/merges","archive_url":"https://api.github.com/repos/gonum/stat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/stat/downloads","issues_url":"https://api.github.com/repos/gonum/stat/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/stat/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/stat/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/stat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/stat/labels{/name}","releases_url":"https://api.github.com/repos/gonum/stat/releases{/id}","created_at":"2014-08-04T23:07:41Z","updated_at":"2015-06-02T19:44:42Z","pushed_at":"2015-06-04T00:44:07Z","git_url":"git://github.com/gonum/stat.git","ssh_url":"git@github.com:gonum/stat.git","clone_url":"https://github.com/gonum/stat.git","svn_url":"https://github.com/gonum/stat","homepage":"","size":1177,"stargazers_count":37,"watchers_count":37,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":37,"default_branch":"master"}},"base":{"label":"gonum:master","ref":"master","sha":"11b7e99975f88b1180ebeaf00cedecae1c942d8a","user":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"repo":{"id":22622955,"name":"stat","full_name":"gonum/stat","owner":{"login":"gonum","id":3771091,"avatar_url":"https://avatars.githubusercontent.com/u/3771091?v=3","gravatar_id":"","url":"https://api.github.com/users/gonum","html_url":"https://github.com/gonum","followers_url":"https://api.github.com/users/gonum/followers","following_url":"https://api.github.com/users/gonum/following{/other_user}","gists_url":"https://api.github.com/users/gonum/gists{/gist_id}","starred_url":"https://api.github.com/users/gonum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonum/subscriptions","organizations_url":"https://api.github.com/users/gonum/orgs","repos_url":"https://api.github.com/users/gonum/repos","events_url":"https://api.github.com/users/gonum/events{/privacy}","received_events_url":"https://api.github.com/users/gonum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gonum/stat","description":"Statistics package for Go","fork":false,"url":"https://api.github.com/repos/gonum/stat","forks_url":"https://api.github.com/repos/gonum/stat/forks","keys_url":"https://api.github.com/repos/gonum/stat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gonum/stat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gonum/stat/teams","hooks_url":"https://api.github.com/repos/gonum/stat/hooks","issue_events_url":"https://api.github.com/repos/gonum/stat/issues/events{/number}","events_url":"https://api.github.com/repos/gonum/stat/events","assignees_url":"https://api.github.com/repos/gonum/stat/assignees{/user}","branches_url":"https://api.github.com/repos/gonum/stat/branches{/branch}","tags_url":"https://api.github.com/repos/gonum/stat/tags","blobs_url":"https://api.github.com/repos/gonum/stat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gonum/stat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gonum/stat/git/refs{/sha}","trees_url":"https://api.github.com/repos/gonum/stat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gonum/stat/statuses/{sha}","languages_url":"https://api.github.com/repos/gonum/stat/languages","stargazers_url":"https://api.github.com/repos/gonum/stat/stargazers","contributors_url":"https://api.github.com/repos/gonum/stat/contributors","subscribers_url":"https://api.github.com/repos/gonum/stat/subscribers","subscription_url":"https://api.github.com/repos/gonum/stat/subscription","commits_url":"https://api.github.com/repos/gonum/stat/commits{/sha}","git_commits_url":"https://api.github.com/repos/gonum/stat/git/commits{/sha}","comments_url":"https://api.github.com/repos/gonum/stat/comments{/number}","issue_comment_url":"https://api.github.com/repos/gonum/stat/issues/comments{/number}","contents_url":"https://api.github.com/repos/gonum/stat/contents/{+path}","compare_url":"https://api.github.com/repos/gonum/stat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gonum/stat/merges","archive_url":"https://api.github.com/repos/gonum/stat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gonum/stat/downloads","issues_url":"https://api.github.com/repos/gonum/stat/issues{/number}","pulls_url":"https://api.github.com/repos/gonum/stat/pulls{/number}","milestones_url":"https://api.github.com/repos/gonum/stat/milestones{/number}","notifications_url":"https://api.github.com/repos/gonum/stat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gonum/stat/labels{/name}","releases_url":"https://api.github.com/repos/gonum/stat/releases{/id}","created_at":"2014-08-04T23:07:41Z","updated_at":"2015-06-02T19:44:42Z","pushed_at":"2015-06-04T00:44:07Z","git_url":"git://github.com/gonum/stat.git","ssh_url":"git@github.com:gonum/stat.git","clone_url":"https://github.com/gonum/stat.git","svn_url":"https://github.com/gonum/stat","homepage":"","size":1177,"stargazers_count":37,"watchers_count":37,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gonum/stat/pulls/43"},"html":{"href":"https://github.com/gonum/stat/pull/43"},"issue":{"href":"https://api.github.com/repos/gonum/stat/issues/43"},"comments":{"href":"https://api.github.com/repos/gonum/stat/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/gonum/stat/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/gonum/stat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gonum/stat/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/gonum/stat/statuses/5016f5097b14a650bb00c9e893d5bd235521f2f7"}}}}