{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/168","repository_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org","labels_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/168/comments","events_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/168/events","html_url":"https://github.com/elm-lang/package.elm-lang.org/issues/168","id":154080354,"number":168,"title":"Effect manager review for mgold/elm-random-pcg","user":{"login":"mgold","id":1191970,"avatar_url":"https://avatars.githubusercontent.com/u/1191970?v=3","gravatar_id":"","url":"https://api.github.com/users/mgold","html_url":"https://github.com/mgold","followers_url":"https://api.github.com/users/mgold/followers","following_url":"https://api.github.com/users/mgold/following{/other_user}","gists_url":"https://api.github.com/users/mgold/gists{/gist_id}","starred_url":"https://api.github.com/users/mgold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgold/subscriptions","organizations_url":"https://api.github.com/users/mgold/orgs","repos_url":"https://api.github.com/users/mgold/repos","events_url":"https://api.github.com/users/mgold/events{/privacy}","received_events_url":"https://api.github.com/users/mgold/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-10T18:55:37Z","updated_at":"2016-05-11T00:15:26Z","closed_at":null,"body":"I'd like to allow randomness-as-a-service under the same API, and same effect implementation, as core/Random.\r\n\r\nThe primary API of `Random.Pcg` is that one can replace `import Random` with `import Random.Pcg as Random` and everything still works. Version 2.0.0 comes as close as possible without being an approved effects module. The [final difference](https://github.com/mgold/elm-random-pcg/commit/2c9c1e24e900f1237b0b6340ea3333a018eb4c40#diff-e582c4053a4e63d4879dcbd753ceec79) involves adding the `generate` function and all of the infrastructure that goes with it, again all copied straight from core."},"comment":{"url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/comments/218328986","html_url":"https://github.com/elm-lang/package.elm-lang.org/issues/168#issuecomment-218328986","issue_url":"https://api.github.com/repos/elm-lang/package.elm-lang.org/issues/168","id":218328986,"user":{"login":"mgold","id":1191970,"avatar_url":"https://avatars.githubusercontent.com/u/1191970?v=3","gravatar_id":"","url":"https://api.github.com/users/mgold","html_url":"https://github.com/mgold","followers_url":"https://api.github.com/users/mgold/followers","following_url":"https://api.github.com/users/mgold/following{/other_user}","gists_url":"https://api.github.com/users/mgold/gists{/gist_id}","starred_url":"https://api.github.com/users/mgold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgold/subscriptions","organizations_url":"https://api.github.com/users/mgold/orgs","repos_url":"https://api.github.com/users/mgold/repos","events_url":"https://api.github.com/users/mgold/events{/privacy}","received_events_url":"https://api.github.com/users/mgold/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T00:15:26Z","updated_at":"2016-05-11T00:15:26Z","body":"Because `Random.Generator` and `Random.Pcg.Generator` are two completely different types. They have to be so primitives like `int` and `float` can use a completely different RNG. Different algorithm, and different seed (it stores more bits).\r\n\r\n`Random.generate` always returns a value computed with the core's RNG, whose [demonstrable poor statistical quality](https://github.com/mgold/elm-random-pcg/tree/master/test/dieharder#dieharder-tests-for-randompcg) is one of the reasons for Pcg's existence. The only way to build one on the other is to generate seeds from core's Random and feed them to Pcg:\r\n\r\n```elm\r\nint64 : Random.Generator\r\nint64 =\r\n  let\r\n    int32 = Random.int 0 0xFFFFFFFF\r\n  in\r\n    Random.pair int32 int32\r\n\r\npcgGenerate tagger generator =\r\n  let\r\n    coreToPcg (seedA, seedB) =\r\n      Pcg.step generator (Pcg.initialSeed2 seedA seedB) |> fst |> tagger\r\n  in\r\n    Random.generate coreToPcg int64\r\n```\r\nThis is the same trick I use in `Random.Pcg.Interop` but even then it's not considered ideal and hopefully done only once. RNGs are garbage-in, garbage-out, and trying to generate seeds from an inferior source many times will leads to compromised statistical strength.\r\n\r\n...I think. @jvoigtlaender am I misinformed about the statistical properties of [this approach](https://github.com/mgold/elm-random-pcg/commit/772e24bf35391b93370f989abac946608ca1998e) over many calls?"}}