{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/476","repository_url":"https://api.github.com/repos/rust-lang-nursery/rand","labels_url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/476/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/476/comments","events_url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/476/events","html_url":"https://github.com/rust-lang-nursery/rand/issues/476","id":326303695,"number":476,"title":"Uniform<f32/f64> should honor high/low limits","user":{"login":"sicking","id":1831914,"avatar_url":"https://avatars2.githubusercontent.com/u/1831914?v=4","gravatar_id":"","url":"https://api.github.com/users/sicking","html_url":"https://github.com/sicking","followers_url":"https://api.github.com/users/sicking/followers","following_url":"https://api.github.com/users/sicking/following{/other_user}","gists_url":"https://api.github.com/users/sicking/gists{/gist_id}","starred_url":"https://api.github.com/users/sicking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sicking/subscriptions","organizations_url":"https://api.github.com/users/sicking/orgs","repos_url":"https://api.github.com/users/sicking/repos","events_url":"https://api.github.com/users/sicking/events{/privacy}","received_events_url":"https://api.github.com/users/sicking/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-24T21:34:28Z","updated_at":"2018-05-25T14:02:14Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"We should require that all `Uniform` distributions stick to the `high`/`low` limits, even in the face of rounding issues. Users are likely to see unexpected and hard-to-reproduce bugs if the returned value on rare occasions will be outside of the specified limits.\r\n\r\nOne example that I ran into was while implementing `choose_weighted` for dhardy/rand#82. If the generated number can be slightly higher than `high`, that means that we risk iterating through the whole item-set without selecting any item to return.\r\n\r\nThe simplest approach is to simply check the generated value against high/low and loop if it doesn't fit withing the desired boundaries. However that runs into problem when `scale` rounds to infinity, since then we'll just loop forever.\r\n\r\nLooking into some alternative approaches instead."},"comment":{"url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/comments/392067657","html_url":"https://github.com/rust-lang-nursery/rand/issues/476#issuecomment-392067657","issue_url":"https://api.github.com/repos/rust-lang-nursery/rand/issues/476","id":392067657,"user":{"login":"dhardy","id":134893,"avatar_url":"https://avatars1.githubusercontent.com/u/134893?v=4","gravatar_id":"","url":"https://api.github.com/users/dhardy","html_url":"https://github.com/dhardy","followers_url":"https://api.github.com/users/dhardy/followers","following_url":"https://api.github.com/users/dhardy/following{/other_user}","gists_url":"https://api.github.com/users/dhardy/gists{/gist_id}","starred_url":"https://api.github.com/users/dhardy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhardy/subscriptions","organizations_url":"https://api.github.com/users/dhardy/orgs","repos_url":"https://api.github.com/users/dhardy/repos","events_url":"https://api.github.com/users/dhardy/events{/privacy}","received_events_url":"https://api.github.com/users/dhardy/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T14:02:13Z","updated_at":"2018-05-25T14:02:13Z","author_association":"COLLABORATOR","body":"*Probably* either rejection sampling or clamping will be needed...\r\n\r\nI'd rather see a complete solution for one particular problem (e.g. `choose_weighted`), and *then* discuss whether to adjust `Uniform` sampling. Use guard functions for the sampling if necessary."}}
{"actor":{"display_login":"dhardy"}}