{"action":"created","issue":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/3842","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/3842/labels{/name}","comments_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/3842/comments","events_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/3842/events","html_url":"https://github.com/openframeworks/openFrameworks/pull/3842","id":77401760,"number":3842,"title":"change denominator of ofRandomuf from float to double.","user":{"login":"2bbb","id":200899,"avatar_url":"https://avatars.githubusercontent.com/u/200899?v=3","gravatar_id":"","url":"https://api.github.com/users/2bbb","html_url":"https://github.com/2bbb","followers_url":"https://api.github.com/users/2bbb/followers","following_url":"https://api.github.com/users/2bbb/following{/other_user}","gists_url":"https://api.github.com/users/2bbb/gists{/gist_id}","starred_url":"https://api.github.com/users/2bbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2bbb/subscriptions","organizations_url":"https://api.github.com/users/2bbb/orgs","repos_url":"https://api.github.com/users/2bbb/repos","events_url":"https://api.github.com/users/2bbb/events{/privacy}","received_events_url":"https://api.github.com/users/2bbb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-05-17T21:21:19Z","updated_at":"2015-05-21T16:28:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/pulls/3842","html_url":"https://github.com/openframeworks/openFrameworks/pull/3842","diff_url":"https://github.com/openframeworks/openFrameworks/pull/3842.diff","patch_url":"https://github.com/openframeworks/openFrameworks/pull/3842.patch"},"body":"change from `(RAND_MAX + 1.0f)` to `(static_cast<double>(RAND_MAX) + 1.0)`.\r\n\r\nBecause, if RAND_MAX is sufficiently large as larger than float precision, then `RAND_MAX + 1.0f == RAND_MAX`.\r\nIn other words, often `rand() / (RAND_MAX + 1.0f)` returns `1.0f`\r\n\r\nAnd, added `static_cast<double>` to clarify the meaning.\r\n\r\nAt the same time, replace same codes like `rand() / (RAND_MAX + 1.0f)` to `ofRandomuf()`.\r\nMaybe this tiny code will be inline expanded automatically when compiling.\r\n\r\nmore discussion about this: please see #3762\r\n"},"comment":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/comments/104344552","html_url":"https://github.com/openframeworks/openFrameworks/pull/3842#issuecomment-104344552","issue_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/3842","id":104344552,"user":{"login":"2bbb","id":200899,"avatar_url":"https://avatars.githubusercontent.com/u/200899?v=3","gravatar_id":"","url":"https://api.github.com/users/2bbb","html_url":"https://github.com/2bbb","followers_url":"https://api.github.com/users/2bbb/followers","following_url":"https://api.github.com/users/2bbb/following{/other_user}","gists_url":"https://api.github.com/users/2bbb/gists{/gist_id}","starred_url":"https://api.github.com/users/2bbb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2bbb/subscriptions","organizations_url":"https://api.github.com/users/2bbb/orgs","repos_url":"https://api.github.com/users/2bbb/repos","events_url":"https://api.github.com/users/2bbb/events{/privacy}","received_events_url":"https://api.github.com/users/2bbb/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T16:28:58Z","updated_at":"2015-05-21T16:28:58Z","body":"@kylemcdonald @arturoc \r\ni feel you are great!\r\nand i pushed source is based on kyle's code with artruro pointed out.\r\n\r\ni do test that gives some value range for ofRandom, and all is correct.\r\nbut, i found a tiny concern at this small code.\r\n\r\n`\r\nfloat large_range_check(float low, float high) {\r\n\tfloat range = high - low;\r\n\tfloat little_bit_small_range = (high - low) - std::numeric_limits<float>::epsilon();\r\n\t\r\n\tprintf(\"%x\\n\", *(reinterpret_cast<int *>(&range)));\r\n\tprintf(\"%x\\n\", *(reinterpret_cast<int *>(&little_bit_small_range)));\r\n}\r\n\r\nlarge_range_check(0.0f, std::numeric_limits<float>::max());\r\n`\r\n\r\nand results:\r\n`\r\n7f7fffff\r\n7f7fffff\r\n`\r\n\r\ni'm thinking about \"really does this fact has nothing like problems?\"."}}