{"action":"created","comment":{"url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/comments/69256657","id":69256657,"diff_hunk":"@@ -0,0 +1,64 @@\n+package akka.stream.contrib\n+\n+import akka.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}\n+import akka.stream.{Attributes, FlowShape, Inlet, Outlet}\n+\n+object Sample\n+{\n+  /**\n+    *\n+    * returns every nth elements\n+    *\n+    * @param nth\n+    * @tparam T\n+    * @return\n+    */\n+  def apply[T](nth: Int): Sample[T] = Sample[T](() => nth)\n+\n+  // def random[T](maxStep: Int = 1000, random: Random = Random): Sample[T] = Sample[T](() => random.nextInt(maxStep))","path":"src/main/scala/akka/stream/contrib/Sample.scala","position":18,"original_position":18,"commit_id":"6120ca2932678c22a00c6514a81ba4eed7744142","original_commit_id":"6120ca2932678c22a00c6514a81ba4eed7744142","user":{"login":"patriknw","id":336161,"avatar_url":"https://avatars.githubusercontent.com/u/336161?v=3","gravatar_id":"","url":"https://api.github.com/users/patriknw","html_url":"https://github.com/patriknw","followers_url":"https://api.github.com/users/patriknw/followers","following_url":"https://api.github.com/users/patriknw/following{/other_user}","gists_url":"https://api.github.com/users/patriknw/gists{/gist_id}","starred_url":"https://api.github.com/users/patriknw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patriknw/subscriptions","organizations_url":"https://api.github.com/users/patriknw/orgs","repos_url":"https://api.github.com/users/patriknw/repos","events_url":"https://api.github.com/users/patriknw/events{/privacy}","received_events_url":"https://api.github.com/users/patriknw/received_events","type":"User","site_admin":false},"body":"instead of `scala.Random` I think it should be `java.util.Random`.\r\n\r\nI think the default implementation should use `java.util.concurrent.ThreadLocalRandom`, i.e.\r\n\r\n    def random[T](maxStep: Int = 1000): Sample[T] = Sample[T](() => ThreadLocalRandom.current().nextInt(maxStep))","created_at":"2016-07-01T06:46:48Z","updated_at":"2016-07-01T06:46:48Z","html_url":"https://github.com/akka/akka-stream-contrib/pull/23#discussion_r69256657","pull_request_url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23","_links":{"self":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/comments/69256657"},"html":{"href":"https://github.com/akka/akka-stream-contrib/pull/23#discussion_r69256657"},"pull_request":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23","id":73789646,"html_url":"https://github.com/akka/akka-stream-contrib/pull/23","diff_url":"https://github.com/akka/akka-stream-contrib/pull/23.diff","patch_url":"https://github.com/akka/akka-stream-contrib/pull/23.patch","issue_url":"https://api.github.com/repos/akka/akka-stream-contrib/issues/23","number":23,"state":"open","locked":false,"title":"WIP: add sample stage","user":{"login":"zhxiaogg","id":6303886,"avatar_url":"https://avatars.githubusercontent.com/u/6303886?v=3","gravatar_id":"","url":"https://api.github.com/users/zhxiaogg","html_url":"https://github.com/zhxiaogg","followers_url":"https://api.github.com/users/zhxiaogg/followers","following_url":"https://api.github.com/users/zhxiaogg/following{/other_user}","gists_url":"https://api.github.com/users/zhxiaogg/gists{/gist_id}","starred_url":"https://api.github.com/users/zhxiaogg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhxiaogg/subscriptions","organizations_url":"https://api.github.com/users/zhxiaogg/orgs","repos_url":"https://api.github.com/users/zhxiaogg/repos","events_url":"https://api.github.com/users/zhxiaogg/events{/privacy}","received_events_url":"https://api.github.com/users/zhxiaogg/received_events","type":"User","site_admin":false},"body":"ref #21 \r\n\r\nI started by a simple implementation. \r\n\r\nquestions:\r\n- I tried `def apply(maxStep:Int, random:Random=Random)` for random sampling, but looks wired. Any suggestion?\r\n- need to implement time-based sampling?\r\n\r\nFeel free to review or close it.","created_at":"2016-06-14T18:27:22Z","updated_at":"2016-07-01T06:46:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a78c2a918249ae06184722f5401a79b6f24aa9c9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23/commits","review_comments_url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23/comments","review_comment_url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/akka/akka-stream-contrib/issues/23/comments","statuses_url":"https://api.github.com/repos/akka/akka-stream-contrib/statuses/6120ca2932678c22a00c6514a81ba4eed7744142","head":{"label":"zhxiaogg:feature/add_sample_stage","ref":"feature/add_sample_stage","sha":"6120ca2932678c22a00c6514a81ba4eed7744142","user":{"login":"zhxiaogg","id":6303886,"avatar_url":"https://avatars.githubusercontent.com/u/6303886?v=3","gravatar_id":"","url":"https://api.github.com/users/zhxiaogg","html_url":"https://github.com/zhxiaogg","followers_url":"https://api.github.com/users/zhxiaogg/followers","following_url":"https://api.github.com/users/zhxiaogg/following{/other_user}","gists_url":"https://api.github.com/users/zhxiaogg/gists{/gist_id}","starred_url":"https://api.github.com/users/zhxiaogg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhxiaogg/subscriptions","organizations_url":"https://api.github.com/users/zhxiaogg/orgs","repos_url":"https://api.github.com/users/zhxiaogg/repos","events_url":"https://api.github.com/users/zhxiaogg/events{/privacy}","received_events_url":"https://api.github.com/users/zhxiaogg/received_events","type":"User","site_admin":false},"repo":{"id":61145494,"name":"akka-stream-contrib","full_name":"zhxiaogg/akka-stream-contrib","owner":{"login":"zhxiaogg","id":6303886,"avatar_url":"https://avatars.githubusercontent.com/u/6303886?v=3","gravatar_id":"","url":"https://api.github.com/users/zhxiaogg","html_url":"https://github.com/zhxiaogg","followers_url":"https://api.github.com/users/zhxiaogg/followers","following_url":"https://api.github.com/users/zhxiaogg/following{/other_user}","gists_url":"https://api.github.com/users/zhxiaogg/gists{/gist_id}","starred_url":"https://api.github.com/users/zhxiaogg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhxiaogg/subscriptions","organizations_url":"https://api.github.com/users/zhxiaogg/orgs","repos_url":"https://api.github.com/users/zhxiaogg/repos","events_url":"https://api.github.com/users/zhxiaogg/events{/privacy}","received_events_url":"https://api.github.com/users/zhxiaogg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhxiaogg/akka-stream-contrib","description":"Add-ons to Akka Stream","fork":true,"url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib","forks_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/forks","keys_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/teams","hooks_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/hooks","issue_events_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/issues/events{/number}","events_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/events","assignees_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/assignees{/user}","branches_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/branches{/branch}","tags_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/tags","blobs_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/languages","stargazers_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/stargazers","contributors_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/contributors","subscribers_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/subscribers","subscription_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/subscription","commits_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/contents/{+path}","compare_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/merges","archive_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/downloads","issues_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/issues{/number}","pulls_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/labels{/name}","releases_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/releases{/id}","deployments_url":"https://api.github.com/repos/zhxiaogg/akka-stream-contrib/deployments","created_at":"2016-06-14T18:15:33Z","updated_at":"2016-06-14T18:15:34Z","pushed_at":"2016-06-14T18:19:32Z","git_url":"git://github.com/zhxiaogg/akka-stream-contrib.git","ssh_url":"git@github.com:zhxiaogg/akka-stream-contrib.git","clone_url":"https://github.com/zhxiaogg/akka-stream-contrib.git","svn_url":"https://github.com/zhxiaogg/akka-stream-contrib","homepage":null,"size":31,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"akka:master","ref":"master","sha":"56540d7ddc193dd7e3d33c3d8d3b12acbc565793","user":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"repo":{"id":58454852,"name":"akka-stream-contrib","full_name":"akka/akka-stream-contrib","owner":{"login":"akka","id":1496237,"avatar_url":"https://avatars.githubusercontent.com/u/1496237?v=3","gravatar_id":"","url":"https://api.github.com/users/akka","html_url":"https://github.com/akka","followers_url":"https://api.github.com/users/akka/followers","following_url":"https://api.github.com/users/akka/following{/other_user}","gists_url":"https://api.github.com/users/akka/gists{/gist_id}","starred_url":"https://api.github.com/users/akka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akka/subscriptions","organizations_url":"https://api.github.com/users/akka/orgs","repos_url":"https://api.github.com/users/akka/repos","events_url":"https://api.github.com/users/akka/events{/privacy}","received_events_url":"https://api.github.com/users/akka/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akka/akka-stream-contrib","description":"Add-ons to Akka Stream","fork":false,"url":"https://api.github.com/repos/akka/akka-stream-contrib","forks_url":"https://api.github.com/repos/akka/akka-stream-contrib/forks","keys_url":"https://api.github.com/repos/akka/akka-stream-contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akka/akka-stream-contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akka/akka-stream-contrib/teams","hooks_url":"https://api.github.com/repos/akka/akka-stream-contrib/hooks","issue_events_url":"https://api.github.com/repos/akka/akka-stream-contrib/issues/events{/number}","events_url":"https://api.github.com/repos/akka/akka-stream-contrib/events","assignees_url":"https://api.github.com/repos/akka/akka-stream-contrib/assignees{/user}","branches_url":"https://api.github.com/repos/akka/akka-stream-contrib/branches{/branch}","tags_url":"https://api.github.com/repos/akka/akka-stream-contrib/tags","blobs_url":"https://api.github.com/repos/akka/akka-stream-contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akka/akka-stream-contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akka/akka-stream-contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/akka/akka-stream-contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akka/akka-stream-contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/akka/akka-stream-contrib/languages","stargazers_url":"https://api.github.com/repos/akka/akka-stream-contrib/stargazers","contributors_url":"https://api.github.com/repos/akka/akka-stream-contrib/contributors","subscribers_url":"https://api.github.com/repos/akka/akka-stream-contrib/subscribers","subscription_url":"https://api.github.com/repos/akka/akka-stream-contrib/subscription","commits_url":"https://api.github.com/repos/akka/akka-stream-contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/akka/akka-stream-contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/akka/akka-stream-contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/akka/akka-stream-contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/akka/akka-stream-contrib/contents/{+path}","compare_url":"https://api.github.com/repos/akka/akka-stream-contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akka/akka-stream-contrib/merges","archive_url":"https://api.github.com/repos/akka/akka-stream-contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akka/akka-stream-contrib/downloads","issues_url":"https://api.github.com/repos/akka/akka-stream-contrib/issues{/number}","pulls_url":"https://api.github.com/repos/akka/akka-stream-contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/akka/akka-stream-contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/akka/akka-stream-contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akka/akka-stream-contrib/labels{/name}","releases_url":"https://api.github.com/repos/akka/akka-stream-contrib/releases{/id}","deployments_url":"https://api.github.com/repos/akka/akka-stream-contrib/deployments","created_at":"2016-05-10T11:13:49Z","updated_at":"2016-06-30T04:51:21Z","pushed_at":"2016-06-30T12:34:03Z","git_url":"git://github.com/akka/akka-stream-contrib.git","ssh_url":"git@github.com:akka/akka-stream-contrib.git","clone_url":"https://github.com/akka/akka-stream-contrib.git","svn_url":"https://github.com/akka/akka-stream-contrib","homepage":null,"size":45,"stargazers_count":29,"watchers_count":29,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":12,"forks":8,"open_issues":12,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23"},"html":{"href":"https://github.com/akka/akka-stream-contrib/pull/23"},"issue":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/issues/23"},"comments":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/akka/akka-stream-contrib/statuses/6120ca2932678c22a00c6514a81ba4eed7744142"}}}}
{"actor":{"display_login":"patriknw"}}