{"action":"created","issue":{"url":"https://api.github.com/repos/opencv/opencv/issues/12758","repository_url":"https://api.github.com/repos/opencv/opencv","labels_url":"https://api.github.com/repos/opencv/opencv/issues/12758/labels{/name}","comments_url":"https://api.github.com/repos/opencv/opencv/issues/12758/comments","events_url":"https://api.github.com/repos/opencv/opencv/issues/12758/events","html_url":"https://github.com/opencv/opencv/pull/12758","id":367467658,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwODkzMjEz","number":12758,"title":"Utilize std::mt19937_64 generator","user":{"login":"cv3d","id":42140441,"node_id":"MDQ6VXNlcjQyMTQwNDQx","avatar_url":"https://avatars1.githubusercontent.com/u/42140441?v=4","gravatar_id":"","url":"https://api.github.com/users/cv3d","html_url":"https://github.com/cv3d","followers_url":"https://api.github.com/users/cv3d/followers","following_url":"https://api.github.com/users/cv3d/following{/other_user}","gists_url":"https://api.github.com/users/cv3d/gists{/gist_id}","starred_url":"https://api.github.com/users/cv3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cv3d/subscriptions","organizations_url":"https://api.github.com/users/cv3d/orgs","repos_url":"https://api.github.com/users/cv3d/repos","events_url":"https://api.github.com/users/cv3d/events{/privacy}","received_events_url":"https://api.github.com/users/cv3d/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"vpisarev","id":2110786,"node_id":"MDQ6VXNlcjIxMTA3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2110786?v=4","gravatar_id":"","url":"https://api.github.com/users/vpisarev","html_url":"https://github.com/vpisarev","followers_url":"https://api.github.com/users/vpisarev/followers","following_url":"https://api.github.com/users/vpisarev/following{/other_user}","gists_url":"https://api.github.com/users/vpisarev/gists{/gist_id}","starred_url":"https://api.github.com/users/vpisarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vpisarev/subscriptions","organizations_url":"https://api.github.com/users/vpisarev/orgs","repos_url":"https://api.github.com/users/vpisarev/repos","events_url":"https://api.github.com/users/vpisarev/events{/privacy}","received_events_url":"https://api.github.com/users/vpisarev/received_events","type":"User","site_admin":false},"assignees":[{"login":"vpisarev","id":2110786,"node_id":"MDQ6VXNlcjIxMTA3ODY=","avatar_url":"https://avatars0.githubusercontent.com/u/2110786?v=4","gravatar_id":"","url":"https://api.github.com/users/vpisarev","html_url":"https://github.com/vpisarev","followers_url":"https://api.github.com/users/vpisarev/followers","following_url":"https://api.github.com/users/vpisarev/following{/other_user}","gists_url":"https://api.github.com/users/vpisarev/gists{/gist_id}","starred_url":"https://api.github.com/users/vpisarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vpisarev/subscriptions","organizations_url":"https://api.github.com/users/vpisarev/orgs","repos_url":"https://api.github.com/users/vpisarev/repos","events_url":"https://api.github.com/users/vpisarev/events{/privacy}","received_events_url":"https://api.github.com/users/vpisarev/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2018-10-06T15:31:26Z","updated_at":"2018-10-07T20:33:44Z","closed_at":"2018-10-07T19:27:01Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/opencv/opencv/pulls/12758","html_url":"https://github.com/opencv/opencv/pull/12758","diff_url":"https://github.com/opencv/opencv/pull/12758.diff","patch_url":"https://github.com/opencv/opencv/pull/12758.patch"},"body":"### This pullrequest changes\r\nA thin wrapper for `std::mt19937_64` random generator.\r\n\r\nIt solves the following issues:\r\n- Avoid linear congruential generator\r\n```\r\n    a = next() >> 5\r\n    b = next() >> 6\r\n    (a * 67108864.0 + b) \r\n```\r\nor\r\n```\r\nthis*(b - a) + a\r\n```\r\nor\r\n```\r\nrng.next() ^ i\r\n```\r\nThey are extremely bad and have low statistics quality\r\n\r\n- Scale-down rand (e.g. using modulo) without considering powers of two also results in non-uniform distributions..\r\n```\r\nnext() % (b - a) + a\r\n```\r\nor\r\n```\r\nnext() % b\r\n```\r\nBTW: `actual[61]` should be `actual[64]` for the same reason (`% length`)\r\n- Dividing by the generator maximum value does not result in uniform distribution\r\n```\r\n* (1.f / 4294967296.f)\r\n```\r\nor\r\n```\r\n* (1.0 / 9007199254740992.0)\r\n```\r\n\r\nI leave you with [this great talk](https://channel9.msdn.com/Events/GoingNative/2013/rand-Considered-Harmful), in case you want to explore more details.."},"comment":{"url":"https://api.github.com/repos/opencv/opencv/issues/comments/427684720","html_url":"https://github.com/opencv/opencv/pull/12758#issuecomment-427684720","issue_url":"https://api.github.com/repos/opencv/opencv/issues/12758","id":427684720,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzY4NDcyMA==","user":{"login":"cv3d","id":42140441,"node_id":"MDQ6VXNlcjQyMTQwNDQx","avatar_url":"https://avatars1.githubusercontent.com/u/42140441?v=4","gravatar_id":"","url":"https://api.github.com/users/cv3d","html_url":"https://github.com/cv3d","followers_url":"https://api.github.com/users/cv3d/followers","following_url":"https://api.github.com/users/cv3d/following{/other_user}","gists_url":"https://api.github.com/users/cv3d/gists{/gist_id}","starred_url":"https://api.github.com/users/cv3d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cv3d/subscriptions","organizations_url":"https://api.github.com/users/cv3d/orgs","repos_url":"https://api.github.com/users/cv3d/repos","events_url":"https://api.github.com/users/cv3d/events{/privacy}","received_events_url":"https://api.github.com/users/cv3d/received_events","type":"User","site_admin":false},"created_at":"2018-10-07T20:33:43Z","updated_at":"2018-10-07T20:33:43Z","author_association":"CONTRIBUTOR","body":"@vpisarev He is talking about RNG implementation, and I am replacing the MT19937 implementation 😕 "}}
{"actor":{"display_login":"cv3d"}}