{"action":"created","issue":{"url":"https://api.github.com/repos/boostorg/random/issues/50","repository_url":"https://api.github.com/repos/boostorg/random","labels_url":"https://api.github.com/repos/boostorg/random/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/boostorg/random/issues/50/comments","events_url":"https://api.github.com/repos/boostorg/random/issues/50/events","html_url":"https://github.com/boostorg/random/issues/50","id":391465716,"node_id":"MDU6SXNzdWUzOTE0NjU3MTY=","number":50,"title":"Add shorthand for get_random_number","user":{"login":"Mike-Devel","id":43199315,"node_id":"MDQ6VXNlcjQzMTk5MzE1","avatar_url":"https://avatars0.githubusercontent.com/u/43199315?v=4","gravatar_id":"","url":"https://api.github.com/users/Mike-Devel","html_url":"https://github.com/Mike-Devel","followers_url":"https://api.github.com/users/Mike-Devel/followers","following_url":"https://api.github.com/users/Mike-Devel/following{/other_user}","gists_url":"https://api.github.com/users/Mike-Devel/gists{/gist_id}","starred_url":"https://api.github.com/users/Mike-Devel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mike-Devel/subscriptions","organizations_url":"https://api.github.com/users/Mike-Devel/orgs","repos_url":"https://api.github.com/users/Mike-Devel/repos","events_url":"https://api.github.com/users/Mike-Devel/events{/privacy}","received_events_url":"https://api.github.com/users/Mike-Devel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-16T13:08:13Z","updated_at":"2018-12-18T09:17:32Z","closed_at":null,"author_association":"NONE","body":"I hope I haven't just overlooked it, but there seems to be no simple `get_random_number<int>(0,5)` function. \r\n\r\nSure, in some situations I want very precises control over what engine and distribution objects are used, so I can make tradeoffs between performance, memory consumption and random number qualities/properties. But in many more scenarios I just want a random number with some reasonable tradeoffs (as a non-expert in the field, I can't really make a good decision anyway) and due to the relatively complex interface of Boost.Random (and its c++11 version), people are still using `rand` (in particular in tutorials) far too often.\r\n\r\nSo would you consider adding a few convenience functions like get_random_number to this library? I'd be willing to make an according PR, but only if there is a realistic chance this gets merged.  \r\n\r\nOne of the major design questions I've seen in the past was how to make this thread-safe (either use thread_local storage or a mutex. I'd favor the use of a mutex/spinlock and a fast generator, because thread_local storage is not available in some (embedded) environments.\r\n\r\nI think there were also some papers about this to be discussed on the c++ committee, but I don't know what became of them, but maybe the design could follow whatever was proposed there\r\n.\r\n"},"comment":{"url":"https://api.github.com/repos/boostorg/random/issues/comments/448151181","html_url":"https://github.com/boostorg/random/issues/50#issuecomment-448151181","issue_url":"https://api.github.com/repos/boostorg/random/issues/50","id":448151181,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODE1MTE4MQ==","user":{"login":"Mike-Devel","id":43199315,"node_id":"MDQ6VXNlcjQzMTk5MzE1","avatar_url":"https://avatars0.githubusercontent.com/u/43199315?v=4","gravatar_id":"","url":"https://api.github.com/users/Mike-Devel","html_url":"https://github.com/Mike-Devel","followers_url":"https://api.github.com/users/Mike-Devel/followers","following_url":"https://api.github.com/users/Mike-Devel/following{/other_user}","gists_url":"https://api.github.com/users/Mike-Devel/gists{/gist_id}","starred_url":"https://api.github.com/users/Mike-Devel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mike-Devel/subscriptions","organizations_url":"https://api.github.com/users/Mike-Devel/orgs","repos_url":"https://api.github.com/users/Mike-Devel/repos","events_url":"https://api.github.com/users/Mike-Devel/events{/privacy}","received_events_url":"https://api.github.com/users/Mike-Devel/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T09:17:32Z","updated_at":"2018-12-18T09:17:32Z","author_association":"NONE","body":"> The biggest problem with `rand` is that it uses global state. A Boost.Random version of it would not be any better.\r\n\r\nWell, I disagree. As long as it is threadsafe a global rng is just fine. Again, if you need precise control over the performance or you need a repeatable rn sequence you are not going to use it (and you won't use std::default_random_engine either.\r\n\r\nBut rand also has the disadvantage that (at least on some platforms) the quality of the random numbers is very poor and generating anything but an integer between 0 and RAND_MAX becomes tricky. All this can easily be fixed by a proper get_random_number function. \r\n\r\n> No.\r\n\r\nSorry to hear that. "}}
{"actor":{"display_login":"Mike-Devel"}}