{"action":"created","comment":{"url":"https://api.github.com/repos/libmir/mir-random/pulls/comments/222253231","pull_request_review_id":161092239,"id":222253231,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjI1MzIzMQ==","diff_hunk":"@@ -34,868 +23,224 @@ Params:\n     var = random variable (optional)\n     lengths = one or more lengths\n +/\n-auto randomSlice(T, G, D, size_t N)(G gen, D var, size_t[N] lengths...)\n-    if (isSaturatedRandomEngine!G && isRandomVariable!D &&\n+pragma(inline, false)\n+auto randomSlice(G, D, size_t N)(G gen, D var, size_t[N] lengths...)\n+    if (N && isSaturatedRandomEngine!G && isRandomVariable!D &&\n         (is(G == class) || is(G == interface)))\n {\n-    import mir.ndslice.allocation: slice;\n-    import mir.ndslice.slice: slicedField;\n-    return field(gen, var).slicedField(lengths).slice;\n+    import mir.ndslice.allocation: uninitSlice;\n+    alias T = typeof(var(gen));\n+    auto ret = lengths.uninitSlice!T();\n+    foreach (ref e; ret.field)\n+        e = var(gen);\n+    return ret;\n }\n \n /// ditto\n-auto randomSlice(T, G, D, size_t N)(G* gen, D var, size_t[N] lengths...)\n-    if (isSaturatedRandomEngine!G && isRandomVariable!D &&\n-        !is(G == class) && !is(G == interface))\n+pragma(inline, false)\n+auto randomSlice(G, D, size_t N)(scope ref G gen, D var, size_t[N] lengths...)\n+    if (N && isSaturatedRandomEngine!G && isRandomVariable!D &&\n+        is(G == struct))\n {\n-    import mir.ndslice.allocation: slice;\n-    import mir.ndslice.slice: slicedField;\n-    return field(gen, var).slicedField(lengths).slice;\n+    import mir.ndslice.allocation: uninitSlice;\n+    alias T = typeof(var(gen));\n+    auto ret = lengths.uninitSlice!T();\n+    foreach (ref e; ret.field)\n+        e = var(gen);\n+    return ret;\n }\n \n /// ditto\n-auto randomSlice(T, G, D, size_t N)(ref G gen, D var, size_t[N] lengths...)\n-    if (isSaturatedRandomEngine!G && isRandomVariable!D &&\n-        !is(G == class) && !is(G == interface))\n+auto randomSlice(G, D, size_t N)(scope G* gen, D var, size_t[N] lengths...)\n+    if (N && isSaturatedRandomEngine!G && isRandomVariable!D &&\n+        is(G == struct))\n {\n-    import mir.ndslice.allocation: slice;\n-    import mir.ndslice.slice: slicedField;\n-    return field((()@trusted => &gen)(), var).slicedField(lengths).slice;\n+    return randomSlice(*gen, var, lengths);\n }\n \n /// ditto\n-auto randomSlice(T, alias gen = rne, D, size_t N)(D var, size_t[N] lengths...)\n-    if (isSaturatedRandomEngine!(typeof(gen)) && isRandomVariable!D)\n+auto randomSlice(D, size_t N)(D var, size_t[N] lengths...)\n+    if (N && isRandomVariable!D)\n {\n-    import mir.ndslice.allocation: slice;\n-    import mir.ndslice.slice: slicedField;\n-    return field!(T, gen)(var).slicedField(lengths).slice;\n+    return randomSlice(rne, var, lengths);\n }\n \n /// ditto\n+pragma(inline, false)\n auto randomSlice(G, D, size_t N)(G gen, D var, size_t[N] lengths...)\n-    if (isSaturatedRandomEngine!G &&\n+    if (N > 1 && isSaturatedRandomEngine!G && isNdRandomVariable!D &&\n         (is(G == class) || is(G == interface)))\n {\n-    import mir.ndslice.allocation: slice;\n-    import mir.ndslice.slice: slicedField;\n-    return field(gen, var).slicedField(lengths).slice;\n+    import mir.algorithm.iteration: each;\n+    import mir.ndslice.allocation: uninitSlice;\n+    import mir.ndslice.topology: pack;\n+    alias T = D.Element;\n+    auto ret = lengths.uninitSlice!T();\n+    ret.pack!1.each!(a => var(gen, a));","path":"source/mir/random/algorithm.d","position":116,"original_position":116,"commit_id":"efb2d620e1ffc4d4d58660dc248926db919e0670","original_commit_id":"efb2d620e1ffc4d4d58660dc248926db919e0670","user":{"login":"n8sh","id":21227491,"node_id":"MDQ6VXNlcjIxMjI3NDkx","avatar_url":"https://avatars2.githubusercontent.com/u/21227491?v=4","gravatar_id":"","url":"https://api.github.com/users/n8sh","html_url":"https://github.com/n8sh","followers_url":"https://api.github.com/users/n8sh/followers","following_url":"https://api.github.com/users/n8sh/following{/other_user}","gists_url":"https://api.github.com/users/n8sh/gists{/gist_id}","starred_url":"https://api.github.com/users/n8sh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8sh/subscriptions","organizations_url":"https://api.github.com/users/n8sh/orgs","repos_url":"https://api.github.com/users/n8sh/repos","events_url":"https://api.github.com/users/n8sh/events{/privacy}","received_events_url":"https://api.github.com/users/n8sh/received_events","type":"User","site_admin":false},"body":"Checks out.","created_at":"2018-10-03T10:05:38Z","updated_at":"2018-10-03T10:05:38Z","html_url":"https://github.com/libmir/mir-random/pull/100#discussion_r222253231","pull_request_url":"https://api.github.com/repos/libmir/mir-random/pulls/100","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/comments/222253231"},"html":{"href":"https://github.com/libmir/mir-random/pull/100#discussion_r222253231"},"pull_request":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/100"}}},"pull_request":{"url":"https://api.github.com/repos/libmir/mir-random/pulls/100","id":219135562,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTM1NTYy","html_url":"https://github.com/libmir/mir-random/pull/100","diff_url":"https://github.com/libmir/mir-random/pull/100.diff","patch_url":"https://github.com/libmir/mir-random/pull/100.patch","issue_url":"https://api.github.com/repos/libmir/mir-random/issues/100","number":100,"state":"open","locked":false,"title":"fix issue #99","user":{"login":"9il","id":845083,"node_id":"MDQ6VXNlcjg0NTA4Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/845083?v=4","gravatar_id":"","url":"https://api.github.com/users/9il","html_url":"https://github.com/9il","followers_url":"https://api.github.com/users/9il/followers","following_url":"https://api.github.com/users/9il/following{/other_user}","gists_url":"https://api.github.com/users/9il/gists{/gist_id}","starred_url":"https://api.github.com/users/9il/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9il/subscriptions","organizations_url":"https://api.github.com/users/9il/orgs","repos_url":"https://api.github.com/users/9il/repos","events_url":"https://api.github.com/users/9il/events{/privacy}","received_events_url":"https://api.github.com/users/9il/received_events","type":"User","site_admin":false},"body":" - Rework API for `randomSlice` (full rework), `shuffle` (accepts only Slice), `sample` (fix param order).\r\n - Remove `range` and `field` because they can be either secure or consistent with Phobos/Mir.\r\n - Update examples in the readme.","created_at":"2018-09-29T08:49:09Z","updated_at":"2018-10-03T10:05:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1857e394fbb4376529ac962131a05a113a9c4703","assignee":{"login":"n8sh","id":21227491,"node_id":"MDQ6VXNlcjIxMjI3NDkx","avatar_url":"https://avatars2.githubusercontent.com/u/21227491?v=4","gravatar_id":"","url":"https://api.github.com/users/n8sh","html_url":"https://github.com/n8sh","followers_url":"https://api.github.com/users/n8sh/followers","following_url":"https://api.github.com/users/n8sh/following{/other_user}","gists_url":"https://api.github.com/users/n8sh/gists{/gist_id}","starred_url":"https://api.github.com/users/n8sh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8sh/subscriptions","organizations_url":"https://api.github.com/users/n8sh/orgs","repos_url":"https://api.github.com/users/n8sh/repos","events_url":"https://api.github.com/users/n8sh/events{/privacy}","received_events_url":"https://api.github.com/users/n8sh/received_events","type":"User","site_admin":false},"assignees":[{"login":"n8sh","id":21227491,"node_id":"MDQ6VXNlcjIxMjI3NDkx","avatar_url":"https://avatars2.githubusercontent.com/u/21227491?v=4","gravatar_id":"","url":"https://api.github.com/users/n8sh","html_url":"https://github.com/n8sh","followers_url":"https://api.github.com/users/n8sh/followers","following_url":"https://api.github.com/users/n8sh/following{/other_user}","gists_url":"https://api.github.com/users/n8sh/gists{/gist_id}","starred_url":"https://api.github.com/users/n8sh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n8sh/subscriptions","organizations_url":"https://api.github.com/users/n8sh/orgs","repos_url":"https://api.github.com/users/n8sh/repos","events_url":"https://api.github.com/users/n8sh/events{/privacy}","received_events_url":"https://api.github.com/users/n8sh/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/libmir/mir-random/pulls/100/commits","review_comments_url":"https://api.github.com/repos/libmir/mir-random/pulls/100/comments","review_comment_url":"https://api.github.com/repos/libmir/mir-random/pulls/comments{/number}","comments_url":"https://api.github.com/repos/libmir/mir-random/issues/100/comments","statuses_url":"https://api.github.com/repos/libmir/mir-random/statuses/efb2d620e1ffc4d4d58660dc248926db919e0670","head":{"label":"libmir:issue99","ref":"issue99","sha":"efb2d620e1ffc4d4d58660dc248926db919e0670","user":{"login":"libmir","id":18573637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NTczNjM3","avatar_url":"https://avatars0.githubusercontent.com/u/18573637?v=4","gravatar_id":"","url":"https://api.github.com/users/libmir","html_url":"https://github.com/libmir","followers_url":"https://api.github.com/users/libmir/followers","following_url":"https://api.github.com/users/libmir/following{/other_user}","gists_url":"https://api.github.com/users/libmir/gists{/gist_id}","starred_url":"https://api.github.com/users/libmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libmir/subscriptions","organizations_url":"https://api.github.com/users/libmir/orgs","repos_url":"https://api.github.com/users/libmir/repos","events_url":"https://api.github.com/users/libmir/events{/privacy}","received_events_url":"https://api.github.com/users/libmir/received_events","type":"Organization","site_admin":false},"repo":{"id":74410870,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQxMDg3MA==","name":"mir-random","full_name":"libmir/mir-random","private":false,"owner":{"login":"libmir","id":18573637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NTczNjM3","avatar_url":"https://avatars0.githubusercontent.com/u/18573637?v=4","gravatar_id":"","url":"https://api.github.com/users/libmir","html_url":"https://github.com/libmir","followers_url":"https://api.github.com/users/libmir/followers","following_url":"https://api.github.com/users/libmir/following{/other_user}","gists_url":"https://api.github.com/users/libmir/gists{/gist_id}","starred_url":"https://api.github.com/users/libmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libmir/subscriptions","organizations_url":"https://api.github.com/users/libmir/orgs","repos_url":"https://api.github.com/users/libmir/repos","events_url":"https://api.github.com/users/libmir/events{/privacy}","received_events_url":"https://api.github.com/users/libmir/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/libmir/mir-random","description":"Advanced Random Number Generators","fork":false,"url":"https://api.github.com/repos/libmir/mir-random","forks_url":"https://api.github.com/repos/libmir/mir-random/forks","keys_url":"https://api.github.com/repos/libmir/mir-random/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libmir/mir-random/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libmir/mir-random/teams","hooks_url":"https://api.github.com/repos/libmir/mir-random/hooks","issue_events_url":"https://api.github.com/repos/libmir/mir-random/issues/events{/number}","events_url":"https://api.github.com/repos/libmir/mir-random/events","assignees_url":"https://api.github.com/repos/libmir/mir-random/assignees{/user}","branches_url":"https://api.github.com/repos/libmir/mir-random/branches{/branch}","tags_url":"https://api.github.com/repos/libmir/mir-random/tags","blobs_url":"https://api.github.com/repos/libmir/mir-random/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libmir/mir-random/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libmir/mir-random/git/refs{/sha}","trees_url":"https://api.github.com/repos/libmir/mir-random/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libmir/mir-random/statuses/{sha}","languages_url":"https://api.github.com/repos/libmir/mir-random/languages","stargazers_url":"https://api.github.com/repos/libmir/mir-random/stargazers","contributors_url":"https://api.github.com/repos/libmir/mir-random/contributors","subscribers_url":"https://api.github.com/repos/libmir/mir-random/subscribers","subscription_url":"https://api.github.com/repos/libmir/mir-random/subscription","commits_url":"https://api.github.com/repos/libmir/mir-random/commits{/sha}","git_commits_url":"https://api.github.com/repos/libmir/mir-random/git/commits{/sha}","comments_url":"https://api.github.com/repos/libmir/mir-random/comments{/number}","issue_comment_url":"https://api.github.com/repos/libmir/mir-random/issues/comments{/number}","contents_url":"https://api.github.com/repos/libmir/mir-random/contents/{+path}","compare_url":"https://api.github.com/repos/libmir/mir-random/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libmir/mir-random/merges","archive_url":"https://api.github.com/repos/libmir/mir-random/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libmir/mir-random/downloads","issues_url":"https://api.github.com/repos/libmir/mir-random/issues{/number}","pulls_url":"https://api.github.com/repos/libmir/mir-random/pulls{/number}","milestones_url":"https://api.github.com/repos/libmir/mir-random/milestones{/number}","notifications_url":"https://api.github.com/repos/libmir/mir-random/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libmir/mir-random/labels{/name}","releases_url":"https://api.github.com/repos/libmir/mir-random/releases{/id}","deployments_url":"https://api.github.com/repos/libmir/mir-random/deployments","created_at":"2016-11-21T22:18:49Z","updated_at":"2018-09-25T03:02:53Z","pushed_at":"2018-10-03T09:32:18Z","git_url":"git://github.com/libmir/mir-random.git","ssh_url":"git@github.com:libmir/mir-random.git","clone_url":"https://github.com/libmir/mir-random.git","svn_url":"https://github.com/libmir/mir-random","homepage":"http://docs.random.dlang.io","size":394,"stargazers_count":21,"watchers_count":21,"language":"D","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":10,"open_issues":3,"watchers":21,"default_branch":"master"}},"base":{"label":"libmir:master","ref":"master","sha":"a99a694911331096a584691074a929ff597131fe","user":{"login":"libmir","id":18573637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NTczNjM3","avatar_url":"https://avatars0.githubusercontent.com/u/18573637?v=4","gravatar_id":"","url":"https://api.github.com/users/libmir","html_url":"https://github.com/libmir","followers_url":"https://api.github.com/users/libmir/followers","following_url":"https://api.github.com/users/libmir/following{/other_user}","gists_url":"https://api.github.com/users/libmir/gists{/gist_id}","starred_url":"https://api.github.com/users/libmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libmir/subscriptions","organizations_url":"https://api.github.com/users/libmir/orgs","repos_url":"https://api.github.com/users/libmir/repos","events_url":"https://api.github.com/users/libmir/events{/privacy}","received_events_url":"https://api.github.com/users/libmir/received_events","type":"Organization","site_admin":false},"repo":{"id":74410870,"node_id":"MDEwOlJlcG9zaXRvcnk3NDQxMDg3MA==","name":"mir-random","full_name":"libmir/mir-random","private":false,"owner":{"login":"libmir","id":18573637,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE4NTczNjM3","avatar_url":"https://avatars0.githubusercontent.com/u/18573637?v=4","gravatar_id":"","url":"https://api.github.com/users/libmir","html_url":"https://github.com/libmir","followers_url":"https://api.github.com/users/libmir/followers","following_url":"https://api.github.com/users/libmir/following{/other_user}","gists_url":"https://api.github.com/users/libmir/gists{/gist_id}","starred_url":"https://api.github.com/users/libmir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/libmir/subscriptions","organizations_url":"https://api.github.com/users/libmir/orgs","repos_url":"https://api.github.com/users/libmir/repos","events_url":"https://api.github.com/users/libmir/events{/privacy}","received_events_url":"https://api.github.com/users/libmir/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/libmir/mir-random","description":"Advanced Random Number Generators","fork":false,"url":"https://api.github.com/repos/libmir/mir-random","forks_url":"https://api.github.com/repos/libmir/mir-random/forks","keys_url":"https://api.github.com/repos/libmir/mir-random/keys{/key_id}","collaborators_url":"https://api.github.com/repos/libmir/mir-random/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/libmir/mir-random/teams","hooks_url":"https://api.github.com/repos/libmir/mir-random/hooks","issue_events_url":"https://api.github.com/repos/libmir/mir-random/issues/events{/number}","events_url":"https://api.github.com/repos/libmir/mir-random/events","assignees_url":"https://api.github.com/repos/libmir/mir-random/assignees{/user}","branches_url":"https://api.github.com/repos/libmir/mir-random/branches{/branch}","tags_url":"https://api.github.com/repos/libmir/mir-random/tags","blobs_url":"https://api.github.com/repos/libmir/mir-random/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/libmir/mir-random/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/libmir/mir-random/git/refs{/sha}","trees_url":"https://api.github.com/repos/libmir/mir-random/git/trees{/sha}","statuses_url":"https://api.github.com/repos/libmir/mir-random/statuses/{sha}","languages_url":"https://api.github.com/repos/libmir/mir-random/languages","stargazers_url":"https://api.github.com/repos/libmir/mir-random/stargazers","contributors_url":"https://api.github.com/repos/libmir/mir-random/contributors","subscribers_url":"https://api.github.com/repos/libmir/mir-random/subscribers","subscription_url":"https://api.github.com/repos/libmir/mir-random/subscription","commits_url":"https://api.github.com/repos/libmir/mir-random/commits{/sha}","git_commits_url":"https://api.github.com/repos/libmir/mir-random/git/commits{/sha}","comments_url":"https://api.github.com/repos/libmir/mir-random/comments{/number}","issue_comment_url":"https://api.github.com/repos/libmir/mir-random/issues/comments{/number}","contents_url":"https://api.github.com/repos/libmir/mir-random/contents/{+path}","compare_url":"https://api.github.com/repos/libmir/mir-random/compare/{base}...{head}","merges_url":"https://api.github.com/repos/libmir/mir-random/merges","archive_url":"https://api.github.com/repos/libmir/mir-random/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/libmir/mir-random/downloads","issues_url":"https://api.github.com/repos/libmir/mir-random/issues{/number}","pulls_url":"https://api.github.com/repos/libmir/mir-random/pulls{/number}","milestones_url":"https://api.github.com/repos/libmir/mir-random/milestones{/number}","notifications_url":"https://api.github.com/repos/libmir/mir-random/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/libmir/mir-random/labels{/name}","releases_url":"https://api.github.com/repos/libmir/mir-random/releases{/id}","deployments_url":"https://api.github.com/repos/libmir/mir-random/deployments","created_at":"2016-11-21T22:18:49Z","updated_at":"2018-09-25T03:02:53Z","pushed_at":"2018-10-03T09:32:18Z","git_url":"git://github.com/libmir/mir-random.git","ssh_url":"git@github.com:libmir/mir-random.git","clone_url":"https://github.com/libmir/mir-random.git","svn_url":"https://github.com/libmir/mir-random","homepage":"http://docs.random.dlang.io","size":394,"stargazers_count":21,"watchers_count":21,"language":"D","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":10,"open_issues":3,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/100"},"html":{"href":"https://github.com/libmir/mir-random/pull/100"},"issue":{"href":"https://api.github.com/repos/libmir/mir-random/issues/100"},"comments":{"href":"https://api.github.com/repos/libmir/mir-random/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/libmir/mir-random/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/libmir/mir-random/statuses/efb2d620e1ffc4d4d58660dc248926db919e0670"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"n8sh"}}