{"action":"opened","issue":{"url":"https://api.github.com/repos/minetest/minetest/issues/3039","labels_url":"https://api.github.com/repos/minetest/minetest/issues/3039/labels{/name}","comments_url":"https://api.github.com/repos/minetest/minetest/issues/3039/comments","events_url":"https://api.github.com/repos/minetest/minetest/issues/3039/events","html_url":"https://github.com/minetest/minetest/issues/3039","id":100506888,"number":3039,"title":"Is the threshold in PcgRandom::range(bound) doing its job?","user":{"login":"est31","id":8872119,"avatar_url":"https://avatars.githubusercontent.com/u/8872119?v=3","gravatar_id":"","url":"https://api.github.com/users/est31","html_url":"https://github.com/est31","followers_url":"https://api.github.com/users/est31/followers","following_url":"https://api.github.com/users/est31/following{/other_user}","gists_url":"https://api.github.com/users/est31/gists{/gist_id}","starred_url":"https://api.github.com/users/est31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/est31/subscriptions","organizations_url":"https://api.github.com/users/est31/orgs","repos_url":"https://api.github.com/users/est31/repos","events_url":"https://api.github.com/users/est31/events{/privacy}","received_events_url":"https://api.github.com/users/est31/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T09:47:53Z","updated_at":"2015-08-12T09:47:53Z","closed_at":null,"body":"While fixing #3027, I've ran across PcgRandom's threshold setting in the range method, which kept me wondering, whether the affected code is accurate.\r\nParticularly, I'm interested in how the [threshold setting](https://github.com/minetest/minetest/commit/738fbc66d096575bb9a1694056ce2d627a70c03d#diff-394cf121b2cc4085d04fc6487fdfadbfR109) could work in the PcgRandom::range method. Not sure how something was casted to s32, I've ran a quick test, and observed, that the [threshold is never something else than 0 for bounds up to 100](http://ideone.com/0ufzvo), and I doubt it will have different values above.\r\n\r\nSo I wonder, does the intended threshold really do its job?"}}